c# - Output Method for decimal after SQL command -


i have got issue code. see code below.

return await this.session.database             .command("dbo.getstudentloanamount")             .parameter("@studentid", studentid)             .output("@loanamount", dbtype.decimal, 10)             .firstordefault(0.0); 

i following error when call api.

decimals require both precision , scale specified. call output(string parametername, byte precision, byte scale) instead.

the issue way using output() method. have looked method cannot find examples of it. please advise or steer me document can further analysis?

the issue was using wrong dbtype. modified code following... , worked.

double loanamount = await this.session.database                    .command("dbo.getstudentloanamount")                    .parameter("@studentid", studentid)                    .output("@loanamount", dbtype.double)                    .firstordefault(0.0);  return loanamount > 0; 

instead of using

.output("@loanamount", dbtype.decimal, 10) 

i used

.output("@loanamount", dbtype.double) 

i had tried using

.output("@loanamount", 10, 2) 

but did not work.

i trying convert double decimal.


Comments

Popular posts from this blog

php - Embed BBCode within itself not working -

three.js - how to load gltf in three JS -

sql server - T-SQL: Access DB objects in same schema without qualifying? -