Click here to Skip to main content
15,945,603 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Dear All,

in table definition below
inve_80c_no	int	<br />
inve_80C_PF_VPF	numeric(18, 0)

in c sharp code below.
C#
iCommand.Parameters.Add("@inve_80C_PF_VPF", SqlDbType.NVarChar,200).Value = txt80C_PF_VPF.Text;
is this correct if i am wrong please correct me
Posted
Updated 9-May-12 0:11am
v2

I thing it should be like this
SQL
iCommand.Parameters.Add(new SqlParameter("@inve_80C_PF_VPF", txt80C_PF_VPF.Text));
 
Share this answer
 
v2
hi
c# alternative for numeric is decimal

C#
iCommand.Parameters.Add("@inve_80C_PF_VPF", SqlDbType.Decimal,200).Value = txt80C_PF_VPF.Text;
 
Share this answer
 
I hope This will Work Try it Conside C# page Both as integer

C#
SqlParameter[] sparam = new SqlParameter[1];
sparam[0] = new SqlParameter(@inve_80c_no, SqlDbType.Int);
sparam[0].Value = 15;
 
Share this answer
 
v2
try :

C#
iCommand.Parameters.Add(new SqlParameter("inve_80C_PF_VPF", Convert.ToInt32(txt80C_PF_VPF.Text)));
 
Share this answer
 
v2
try this

C#
iCommand.Parameters.Add
("@inve_80C_PF_VPF", SqlDbType.Decimal).Value = inve_80C_PF_VPF.Text;
 
Share this answer
 
v2
One way is to use SqlParameterCollection.AddWithValue Method [^].

So you could have something like:
C#
iCommand.Parameters.AddWithValue("@inve_80C_PF_VPF", txt80C_PF_VPF.Text);
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900