The following method is written to return the number of rows affected by the data operation:
Copy Code code as follows:
private int Getreturnvalue (string sStr, String conn) {
OleDbConnection odbconn = ACCESSHELP (conn);
OleDbCommand odbcmd = new OleDbCommand (SSTR, odbconn);
Return Odbcmd. ExecuteNonQuery ();
}
Use one of the following methods to invoke this class:
Copy Code code as follows:
public int WSBM (string[] str) {
StringBuilder sb=new StringBuilder ();
Sb. Append ("INSERT into"). Append ("WSBM (Zy, Studentname, ParentName)");
Sb. Append ("VALUES (");
Sb. Append ("' + str[0] +" ', ' "+ str[1] +" ', ' "+ str[2] +" ");
Sb. Append (")");
Return Getreturnvalue (sb.) ToString (), "Odbconn");
}
To send data in this event:
Copy Code code as follows:
protected void Bttj_click (object sender, EventArgs e) {
string[] sStr = new string[] {
This.ddlzy.SelectedItem.Text,
This.tbName.Text,
This.tbbb.Text,
};
if (AD.WSBM (SSTR) > 0) {
Response.Write (' <script>alert (' Insert success! ') </script> ");
}
}
After the implementation of the results of the following figure, what is the reason???
How to solve such a benefit error?????