1
Answer

I am getting error in update statement

Jaspreet Kaur

Jaspreet Kaur

12y
1k
1
OleDbConnection con = new OleDbConnection();
            con.ConnectionString = connection.connstring;
            con.Open();
            OleDbCommand cmd = new OleDbCommand();
            cmd.CommandText="update info set fname=@a,lname=@b,cname=@c,add=@d,contactno=@e,city=@f,pincode=@g where ID='" + textBox2.Text + "'";
            cmd.Connection = con;
            cmd.Parameters.AddWithValue("@a", textBox1.Text);
            cmd.Parameters.AddWithValue("@b", textBox3.Text);
            cmd.Parameters.AddWithValue("@c", textBox4.Text);
            cmd.Parameters.AddWithValue("@d", richTextBox1.Text);
            cmd.Parameters.AddWithValue("@e", textBox5.Text);
            cmd.Parameters.AddWithValue("@f", textBox6.Text);
            cmd.Parameters.AddWithValue("@g", textBox7.Text);
          
            int i = cmd.ExecuteNonQuery();
            if (i > 0)
            {
                MessageBox.Show("Data is updated");
            }

Answers (1)
0
Suthish Nair
NA 31.7k 4.6m 14y

If this query got resolved then please Accept the post that helped you as Answer.
So other members can easily find the answers.
0
Suthish Nair
NA 31.7k 4.6m 14y

Sam is right.

change your code too
1. if (chineseGrade=="A")
2. use double chineseGPA or chineseGPA = Convert.ToDecimal(4.0);

0
Sam Hobbs
NA 28.7k 1.3m 14y
chineseGrade is a string variable but you are using it as if it is a method. The compiler is not psychic and neither are we. What is it that you need to do? As best as I understand your question, you are calculating a GPA for Chinese differently than for other people but as far as I know the Chinese are the same as everyone else. So perhaps the answer is that you can just use the same calculation for Chinese people as everyone else.