本文介绍了')'附近的语法不正确(sql exception)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

UGIcon.Open();
                    cmd = new SqlCommand("update admin set name='" + textBox5.Text + "', age='" + numericUpDown1.Value.ToString() + "', phone='" + numericUpDown2.Value.ToString() + "', question='" + comboBox1.SelectedItem.ToString()+"', answer='" + textBox4.Text + "')", UGIcon);
                    
                       SqlDataReader sd;
                    sd = cmd.ExecuteReader(); i m getting error here 

                    MessageBox.Show("Thank You!!! Your Details updated", "Updation Window", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    groupBox1.Visible = false;
                    UGIcon.Close();

推荐答案

mylib.cmd = new SqlCommand("Update BUHeadMstr set Eid =@Eid, Bid=@Bid,CorpId=@CorpId,CreatedBy=@UId,CreatedOn=@Date where Buheadid =@buheadId    ", mylib.objDBConn);
            mylib.cmd.CommandType = CommandType.Text;



mylib.cmd.Parameters.AddWithValue (@ Eid,objAdmin.Eid);

int i = mylib.cmd.ExecuteNonQuery();


mylib.cmd.Parameters.AddWithValue("@Eid", objAdmin.Eid);
int i = mylib.cmd.ExecuteNonQuery();




这篇关于')'附近的语法不正确(sql exception)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-16 10:36