我使用MS Access在我的ASP.NET Window应用程序中保存数据。当我在数据网格视图中更新日期时,它显示错误“UPDATE语句中的语法错误”,但是当我更新其他字段(如名称,联系号)时,这些字段很容易更新。
public partial class Form1 : Form
{
OleDbConnection con1;
OleDbDataAdapter da1;
DataTable dt1;
OleDbCommandBuilder cmb1;
private void Form1_Load(object sender, EventArgs e)
{
con1 = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=D:\Day Book Data\db\DayBook.accdb;Persist Security Info=False;");
string query1 = "select * from paypayment";
da1 = new OleDbDataAdapter(query1, con1);
dt1 = new DataTable();
con1.Open();
da1.Fill(dt1);
dataGridView2.DataSource = dt1;
con1.Close();
}
private void button3_Click(object sender, EventArgs e)
{
cmb1 = new OleDbCommandBuilder(da1);
da1.Update(dt1);
}
答案 0 :(得分:0)
检查日期格式,使用日期格式:“dd-MMM-yyyy”