Hi .I'm developing asp.net web application. i make sql database with table "reg".and actually i make 2 web forms for reg complete process.
reg1.aspx has username,password,etc...
reg2.aspx has dropdown securityQues.
actually table reg have 3 columns
1.username not null 2.password not null 3.securityQues not null
when i click reg1.aspx submit btn "sqldatabase exception by usercode" cmd.executenonquery(); error.. null values could add on table
plz help for this prlm... sorry for mistakes in english help me adv.thanks for all members
Loading
Prakash PPosted Mar 25, 2013, 10:55 AM
Vishal GilbilePosted Mar 25, 2013, 6:49 AM
This is happening because your table has 3 columns and when you click the button on WebForm1.aspx page you are trying to insert record in your Table by passing two values i.e. for username and password and your security question values is not passed because your this field lies on second page. either try to make your security question field in sql to accept null values or try to merge the content of the two pages into a single page so that on button click event you would be able to pass all the values of the table.
Hope that solves your problem.
With Regards,
Vishal Gilbile.
Sreejesh SPPosted Mar 25, 2013, 6:12 AM
Your input parameter and sql parameter count is mismach then you get this type error,another case your database table fields are not null so must pass three fields,so please review your Input code and stored procedure,another case is your connection
ex:
sqlconnection con=new sqlconnection(@",connection string");
sqlcommand cmd=new sqlcommand();
cmd.connection=con;
cmd.commandtext="
cmd.open();
cmd.executeNonquery();
cmd.close();
please read the above code and apply your application,and check your sql queries and c#code
Thanks
Sreejesh
Pradip PandeyPosted Mar 25, 2013, 5:33 AM
Check your code that if you have fields like usercode in your database tables then must pass the value from the UI otherwise remove the parameter from the UI.
Hope it will help you.