似乎无法找到其他的方式转换成这样:转换失败时转换从字符串vb.net日期和/或时间
sql = "insert into Attendance values('" & Label1.Text & "','" & Button1.Text & "','" & Date.Today & "','" & TimeOfDay & "','null')
Label1.Text
是从员工数据库EmpID
Button1.Text是其状态是时间或超时(备考)
守则出席的SQL Server管理是:
create table Attendance
(
EmpID varchar(25) foreign key references Employee(EmpID),
remarks varchar (25) primary key not null,
checkdate date,
tin time,
tout time,
)
的模式。 [Bobby Tables:防止SQL注入的指南](http://bobby-tables.com/) - 和'null'不是一个字符串,所以不要像' “null''。 – SqlZim
那么你面临的问题是什么?什么是错误信息? –
你的问题在这里:Date.Today&“','”&TimeOfDay应该创建一个日期时间我假设?并且你在表中设置了这个日期 - 如果你正在创建一个日期时间,那么当然你需要 - Date.Today&“''”&TimeOfDay - 你的表创建应该是checkdate datetime, – jimmy8ball