我要把DateTimePicker1的输入保存到SQl数据库中去要怎么弄
SQL语句我是知道的,我想知道怎么得到那上面的输入值
不是那个问题了,出新问题了
'年12月11日附近有语法错误。'
我的SQL语句: strsql = "update Employees set ELName='" & TextYGXS.Text & "',EFName='" & TextYGXM.Text & "',Address='" & TextDZ.Text & "',City='" & TextSZCS.Text & "',State='" & TextSZSF.Text & "',Zip='" & TextYB.Text & "',Phone='" & TextDH.Text & "',Dob=" & DateTimePicker2.Text & ",Doj=" & DateTimePicker1.Text & ",Designation='" & ComboZW.Text & "',DeptID='" & ComboSSBM.Text & "',Password='" & TEXTMM.Text & "' where EmpID='" & ComboYGID.Text & "'"
麻烦了
strsql = "update Employees set ELName='" & TextYGXS.Text & "',EFName='" & TextYGXM.Text & "',Address='" & TextDZ.Text & "',City='" & TextSZCS.Text & "',State='" & TextSZSF.Text & "',Zip='" & TextYB.Text & "',Phone='" & TextDH.Text & "',Dob=" & DateTimePicker2.Text & ",Doj=" & DateTimePicker1.Text & ",Designation='" & ComboZW.Text & "',DeptID='" & ComboSSBM.Text & "',Password='" & TEXTMM.Text & "' where EmpID='" & ComboYGID.Text & "'"
Public Function updatedatabase(ByVal SQLcmd As String)
Try
Dim conn As SqlConnection
Dim cmd As SqlCommand
conn = New SqlConnection(Connstr)
conn.Open()
cmd = New SqlCommand(SQLcmd, conn)
cmd.ExecuteNonQuery()在这个地方就跳到下面去了
conn.Close()
Catch ex As Exception
MsgBox(ex.Message)