Home > Net >  Ask god to help see the red font location where is wrong, thank you ~
Ask god to help see the red font location where is wrong, thank you ~

Time:12-15

Private void button1_Click (object sender, EventArgs e)
{
String constr=@ "Data Source=(LocalDB) \ MSSQLLocalDB; AttachDbFilename=E: \ student \ student \ stu MDF. Integrated Security=True ";
SqlConnection con=new SqlConnection (constr);
Con. The Open ();
[/code] string SQLSTR="update Reward set RewardId='" + textBox1. Text. The ToString () +"', RewardName='" + textBox2. Text. The ToString () + "' from Reward where studentNo='" + textBox3. Text. The ToString () + "' ";
SqlCommand CMD=new SqlCommand (); [/color]
CMD. Connection=con;
Cmd.Com mandText=SQLSTR;
Int r=CMD. ExecuteNonQuery ();
Con. The Close ();
If (r==0)
{
MessageBox. Show (" change failure!" );
}
The else
{
MessageBox. Show (" change success!" );
}
}

CodePudding user response:

Remove the from Reward

CodePudding user response:

reference 1st floor Bridge_go response:
removed from Reward

Still have a problem

CodePudding user response:

StudentNo int or varchar?

CodePudding user response:

Is an int type variable

CodePudding user response:

reference 4 floor goodgame365 response:
studentNo int or varchar?

Is an int type variable
  •  Tags:  
  • C#
  • Related