Home > database >  How to modify the insert statement in the sqlhelper
How to modify the insert statement in the sqlhelper

Time:09-26

Novice a, student information management system, the debugging tip: the column name or the number of values provided do not match with the table definition,
Own SQLhelper couldn't find the database to add and delete statements, I ask where you can modify, their use is vs2010, thank everyone!

CodePudding user response:

Your helper SQL code directly out ah,
At least post the complete code of the function,

Besides, SQL is written by yourself, close the SQL helper?
General call should be similar to:
String SQL="insert into the TAB (c1, c2) values (@ c1, @ c2)";
SqlParameter spArr=new SqlParameter [] [] {
New SqlParameter (" @ c1 ", 21),
New SqlParameter (" @ c2, 52)
};
SqlHelper. ExecuteNonQuery (SQL, spArr);

Several parameters, with a few values, this problem does not match,

CodePudding user response:

Check the night information, a little understood, insert the code also found,
But still thank you for your reply!

CodePudding user response:

refer to the second floor of three lines of monk reply:
checked data at night, a little understood, insert the code also found,
But still thank you for your reply!

You're welcome, nothing to post bar,

CodePudding user response:

Estimated using parameterized, directly insert the column value more,

CodePudding user response:

reference 1/f, gypsy song response:
your SQL directly helper code out ah,
At least post the complete code of the function,

Besides, SQL is written by yourself, close the SQL helper?
General call should be similar to:
String SQL="insert into the TAB (c1, c2) values (@ c1, @ c2)";
SqlParameter spArr=new SqlParameter [] [] {
New SqlParameter (" @ c1 ", 21),
New SqlParameter (" @ c2, 52)
};
SqlHelper. ExecuteNonQuery (SQL, spArr);

Several parameters, with a few values, this problem does not match,

According to this change, there are still problems, I posted the code to open a new post, it is convenient for you can see,

CodePudding user response:

I post the code in the new post, eldest brother see bai again
  • Related