SQL更新时间字段问题
updataStr = "update Table_stockm set " 'set后要留一空格,Table_stockm是一个表If Txtpiaoju.Text.Trim <> "" Then
updataStr = updataStr & "票据号='" & Txtpiaoju.Text.Trim & "',"
Else
updataStr = updataStr & "票据号='',"
If DateTimePicker1.Text.Trim <> "" Then
updataStr = updataStr & "进货日期=#" & DateTimePicker1.Text.Trim & "#"‘错误就出在这,进货日期是一个Sql日期型字段(DateTime)
Else
updataStr = updataStr & "进货日期=''"
End If
updataStr = updataStr & " where 票据号='" & Txtpiaoju.Text.Trim & "'"
Dim Strcon As New SqlConnection(myConn)’myconn是一个字符串,链接数据库的,没有错误
Strcon.Open()
Dim mycommand As New SqlCommand(updataStr, Strcon)
= CommandType.Text
mycommand.ExecuteNonQuery()‘此处提示错误,=====从字符串转换日期和/或时间时,转换失败。