我作了一个和你的功能查不多的程序,但出了很多错误,修改记录时,无出现错误,但数据库里的记录不变,代码如下:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim conn As New SqlConnection
conn.ConnectionString = ConfigurationSettings.AppSettings("aa")
conn.Open()
Dim cmd As New SqlCommand
cmd.Connection = conn
cmd.CommandText = "update info set u_name='" & TextBox1.Text & "',u_sex='" & TextBox2.Text & "',u_birt='" & TextBox3.Text & "',u_indate='" & TextBox4.Text & "',u_code='" & TextBox5.Text & "',u_tel='" & TextBox6.Text & "',u_zhy='" & TextBox7.Text & "',u_dw='" & TextBox8.Text & "',u_time1='" & TextBox9.Text & "',u_sch1='" & TextBox10.Text & "',u_zhy1='" & TextBox11.Text & "',u_time2='" & TextBox12.Text & "',u_sch2='" & TextBox13.Text & "',u_zhy2='" & TextBox14.Text & "',u_time3='" & TextBox15.Text & "',u_sch3='" & TextBox16.Text & "',u_zhy3='" & TextBox17.Text & "',u_chg='" & TextBox18.Text & "',u_ky='" & TextBox19.Text & "',u_xsh='" & TextBox20.Text & "',u_xzhw1='" & TextBox21.Text & "',u_xdate1='" & TextBox22.Text & "',u_xmch1='" & TextBox23.Text & "',u_xzhw2='" & TextBox24.Text & "',u_xdate2='" & TextBox25.Text & "',u_xmch2='" & TextBox26.Text & "',u_xzhw3='" & TextBox27.Text & "',u_xdate3='" & TextBox28.Text & "',u_xmch3='" & TextBox29.Text & "',u_shzhw1='" & TextBox30.Text & "',u_shdate1='" & TextBox31.Text & "',u_shmch1='" & TextBox32.Text & "',u_shzhw2='" & TextBox33.Text & "',u_shdate2='" & TextBox34.Text & "',u_shmch2='" & TextBox35.Text & "',u_shzhw3='" & TextBox36.Text & "',u_shdate3='" & TextBox37.Text & "',u_shmch3='" & TextBox38.Text & "',u_men='" & TextBox39.Text & "' where u_id='" & TextBox40.Text & "'"
cmd.ExecuteNonQuery()
conn.Close()
End Sub