[英]DateTime error type mismatch
I'm trying to insert date and time to my access db using c#, this is what i currently have, but it says mismatch 我正在尝试使用c#将日期和时间插入到我的访问数据库中,这是我目前拥有的,但是它表示不匹配
OleDbConnection myConn = new OleDbConnection();
myConn.ConnectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=F:\Copro-3\Employee.accdb;Persist Security Info=False;";
myConn.Open();
OleDbCommand cmd = new OleDbCommand();
cmd.Connection = myConn;
cmd.CommandText = @"insert into EmployeeTimeIn (FirstName,LastName, TimeIn) values ('"+textBox1.Text+"', '"+textBox2.Text+"' , ?)";
cmd.Parameters.AddWithValue("TimeIn", DateTime.Now);
cmd.ExecuteNonQuery();
MessageBox.Show("Success");
myConn.Close();
I'm trying to insert date and time to my access db using c#, this is what i currently have, but it says "data type mismatch" 我正在尝试使用c#将日期和时间插入到我的Access数据库中,这是我目前拥有的,但是它说“数据类型不匹配”
ms访问表中的TimeIn类型不同于您将TimeIn值作为参数传递
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.