Click here to Skip to main content
15,918,742 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
I am Using following code in asp.net 2, To Insert into Database:

cmd.Parameters.Add("@SCodeNo", SqlDbType.VarChar).Value = TextBox1.Text;
this is O.K

Now I am confused How to set sqlDbType for the data-type numeric(18,0)?
cmd.Parameters.Add("@RegNo", SqlDbType. ).Value = TextBox2.Text;
The problem is there is no Option like numeric(18,0).
Here RegNo = Registration Number and the datatype I am using is numeric(18,0) in database.
Posted

 
Share this answer
 
try using this, it worked for me...

C#
cmd.Parameters.Add("@RegNo", SqlDbType.NVarChar, 18).Value = TextBox2.Text;
 
Share this answer
 
v3
Comments
Nickk Bisht 26-Mar-12 10:15am    
Want's to know do I need to change the DataType numeric(18,0)to NVarChar of the database column RegNo too or Leave it as it is ?
PJ003 26-Mar-12 12:47pm    
it should work, with out changing the datatype in database

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