{
string url = @"provider=Microsoft.ACE.OLEDB.12.0;data source= D:\简历\data\jianli.accdb";
OleDbConnection conn = new OleDbConnection(url);
conn.Open();
string sql = "插入语句“
OleDbCommand cmd = new OleDbCommand(sql, conn);
OleDbDataReader dr = cmd.ExecuteReader();
label.Text = "添加成功";
conn.Close();
}
25 个解决方案
#1
INSERT INTO 语句的语法错误,你竟然不提供最重要的语句,那你还是自己查吧
#2
这搞笑了
#3
insert into语法错误。。。。你的SQL语句就一个 插入语句 你想说什么
#4
sql的格式为:insert into 表(字段1,字段2,字段3,字段4,字段5...) values(值1,值2,值3,值4,值5...)
#5
string sql = "插入语句“。。。。
insert into 表名 values(值,值,值)
insert into 表名 values(值,值,值)
#6
#7
这该怎么回答?
#8
没看到insert语句呀
#9
我也是醉了最关键的没有
#10
小伙子你是不是喝酒了?
#11
string sql = "insert into [jianli]([序号],[类别],[姓名],[性别],[出生日期],[身份证号],[民族],[政治面貌],[户口所在地],[现居住地],[联系电话],[电子邮件],[最高学历],[毕业院校],[是否985/211],[专业一],[专业二],[企业名称1],[岗位简述1],[开始时间1],[结束时间1],[离职原因1],[企业名称2],[岗位简述2],[开始时间2],[结束时间2],[离职原因2])";
sql = sql+"values("+id.Text+","+type.Text+","+name.Text+","+sex.Text+","+data.Text+","+per.Text+","+minzu.Text+","+mianmao.Text+","+hukou.Text+","+home.Text+","+phone.Text+","+email.Text+","+xueli.Text+","+school.Text+","+select.Text+","+major1.Text+","+major2.Text+","+company1.Text+","+jianshu1.Text+","+kaishi1.Text+","+jieshu1.Text+","+lizhi1.Text+","+company2.Text+","+jianshu2.Text+","+kaishi2.Text+","+jieshu2.Text+","+lizhi2.Text+","+beizhu.Text+")";
sql = sql+"values("+id.Text+","+type.Text+","+name.Text+","+sex.Text+","+data.Text+","+per.Text+","+minzu.Text+","+mianmao.Text+","+hukou.Text+","+home.Text+","+phone.Text+","+email.Text+","+xueli.Text+","+school.Text+","+select.Text+","+major1.Text+","+major2.Text+","+company1.Text+","+jianshu1.Text+","+kaishi1.Text+","+jieshu1.Text+","+lizhi1.Text+","+company2.Text+","+jianshu2.Text+","+kaishi2.Text+","+jieshu2.Text+","+lizhi2.Text+","+beizhu.Text+")";
#12
data source= D:\简历\data\jianli.accdb";
.accdb是什么文件?
.accdb是什么文件?
#13
哦,看字母好像新版access数据库名
写出插入语句,楼上都说了
若出错,给出错误报告信息
写出插入语句,楼上都说了
若出错,给出错误报告信息
#14
“/简历”应用程序中的服务器错误。
--------------------------------------------------------------------------------
INSERT INTO 语句的语法错误。
说明: 执行当前 Web 请求期间,出现未经处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。
异常详细信息: System.Data.OleDb.OleDbException: INSERT INTO 语句的语法错误。
源错误:
行 26:
行 27: OleDbCommand cmd = new OleDbCommand(sql, conn);
行 28: OleDbDataReader dr = cmd.ExecuteReader();
行 29: label.Text = "添加成功";
行 30: conn.Close();
源文件: d:\简历\About.aspx.cs 行: 28
堆栈跟踪:
[OleDbException (0x80040e14): INSERT INTO 语句的语法错误。]
System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(OleDbHResult hr) +1084268
System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult) +247
System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult) +194
System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& executeResult) +58
System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method) +167
System.Data.OleDb.OleDbCommand.ExecuteReader(CommandBehavior behavior) +116
System.Data.OleDb.OleDbCommand.ExecuteReader() +6
About.insert_Click(Object sender, EventArgs e) in d:\简历\About.aspx.cs:28
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +118
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +112
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5563
--------------------------------------------------------------------------------
INSERT INTO 语句的语法错误。
说明: 执行当前 Web 请求期间,出现未经处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。
异常详细信息: System.Data.OleDb.OleDbException: INSERT INTO 语句的语法错误。
源错误:
行 26:
行 27: OleDbCommand cmd = new OleDbCommand(sql, conn);
行 28: OleDbDataReader dr = cmd.ExecuteReader();
行 29: label.Text = "添加成功";
行 30: conn.Close();
源文件: d:\简历\About.aspx.cs 行: 28
堆栈跟踪:
[OleDbException (0x80040e14): INSERT INTO 语句的语法错误。]
System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(OleDbHResult hr) +1084268
System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult) +247
System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult) +194
System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& executeResult) +58
System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method) +167
System.Data.OleDb.OleDbCommand.ExecuteReader(CommandBehavior behavior) +116
System.Data.OleDb.OleDbCommand.ExecuteReader() +6
About.insert_Click(Object sender, EventArgs e) in d:\简历\About.aspx.cs:28
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +118
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +112
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5563
#15
你把语句往数据库里一粘就知道哪错了
#16
我X这SQL语句写得真特么的艺术
#17
SQL语句中的values后面的每一个值,如果是字符的,都用'括起来;如果是日期型的,用#括起来;如果是数字,就不用改了。
#18
string sql = "插入语句“
插入语句具体是什么?不可能是这4个汉字吧
插入语句具体是什么?不可能是这4个汉字吧
#19
Sql = " insert into 表XX set ......"
#20
监控你的sql语句 复制下来 你的sql string
然后在access 里执行该语句 找到错误改下
然后在access 里执行该语句 找到错误改下
#21
.ExecuteReader
#22
我也觉得是这里用错了,既然是insert 为啥用read
#23
insert语句你好歹贴出来呀
#24
你到是把sql贴出来
#25
这楼主也是气死人
#1
INSERT INTO 语句的语法错误,你竟然不提供最重要的语句,那你还是自己查吧
#2
这搞笑了
#3
insert into语法错误。。。。你的SQL语句就一个 插入语句 你想说什么
#4
sql的格式为:insert into 表(字段1,字段2,字段3,字段4,字段5...) values(值1,值2,值3,值4,值5...)
#5
string sql = "插入语句“。。。。
insert into 表名 values(值,值,值)
insert into 表名 values(值,值,值)
#6
#7
这该怎么回答?
#8
没看到insert语句呀
#9
我也是醉了最关键的没有
#10
小伙子你是不是喝酒了?
#11
string sql = "insert into [jianli]([序号],[类别],[姓名],[性别],[出生日期],[身份证号],[民族],[政治面貌],[户口所在地],[现居住地],[联系电话],[电子邮件],[最高学历],[毕业院校],[是否985/211],[专业一],[专业二],[企业名称1],[岗位简述1],[开始时间1],[结束时间1],[离职原因1],[企业名称2],[岗位简述2],[开始时间2],[结束时间2],[离职原因2])";
sql = sql+"values("+id.Text+","+type.Text+","+name.Text+","+sex.Text+","+data.Text+","+per.Text+","+minzu.Text+","+mianmao.Text+","+hukou.Text+","+home.Text+","+phone.Text+","+email.Text+","+xueli.Text+","+school.Text+","+select.Text+","+major1.Text+","+major2.Text+","+company1.Text+","+jianshu1.Text+","+kaishi1.Text+","+jieshu1.Text+","+lizhi1.Text+","+company2.Text+","+jianshu2.Text+","+kaishi2.Text+","+jieshu2.Text+","+lizhi2.Text+","+beizhu.Text+")";
sql = sql+"values("+id.Text+","+type.Text+","+name.Text+","+sex.Text+","+data.Text+","+per.Text+","+minzu.Text+","+mianmao.Text+","+hukou.Text+","+home.Text+","+phone.Text+","+email.Text+","+xueli.Text+","+school.Text+","+select.Text+","+major1.Text+","+major2.Text+","+company1.Text+","+jianshu1.Text+","+kaishi1.Text+","+jieshu1.Text+","+lizhi1.Text+","+company2.Text+","+jianshu2.Text+","+kaishi2.Text+","+jieshu2.Text+","+lizhi2.Text+","+beizhu.Text+")";
#12
data source= D:\简历\data\jianli.accdb";
.accdb是什么文件?
.accdb是什么文件?
#13
哦,看字母好像新版access数据库名
写出插入语句,楼上都说了
若出错,给出错误报告信息
写出插入语句,楼上都说了
若出错,给出错误报告信息
#14
“/简历”应用程序中的服务器错误。
--------------------------------------------------------------------------------
INSERT INTO 语句的语法错误。
说明: 执行当前 Web 请求期间,出现未经处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。
异常详细信息: System.Data.OleDb.OleDbException: INSERT INTO 语句的语法错误。
源错误:
行 26:
行 27: OleDbCommand cmd = new OleDbCommand(sql, conn);
行 28: OleDbDataReader dr = cmd.ExecuteReader();
行 29: label.Text = "添加成功";
行 30: conn.Close();
源文件: d:\简历\About.aspx.cs 行: 28
堆栈跟踪:
[OleDbException (0x80040e14): INSERT INTO 语句的语法错误。]
System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(OleDbHResult hr) +1084268
System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult) +247
System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult) +194
System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& executeResult) +58
System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method) +167
System.Data.OleDb.OleDbCommand.ExecuteReader(CommandBehavior behavior) +116
System.Data.OleDb.OleDbCommand.ExecuteReader() +6
About.insert_Click(Object sender, EventArgs e) in d:\简历\About.aspx.cs:28
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +118
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +112
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5563
--------------------------------------------------------------------------------
INSERT INTO 语句的语法错误。
说明: 执行当前 Web 请求期间,出现未经处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。
异常详细信息: System.Data.OleDb.OleDbException: INSERT INTO 语句的语法错误。
源错误:
行 26:
行 27: OleDbCommand cmd = new OleDbCommand(sql, conn);
行 28: OleDbDataReader dr = cmd.ExecuteReader();
行 29: label.Text = "添加成功";
行 30: conn.Close();
源文件: d:\简历\About.aspx.cs 行: 28
堆栈跟踪:
[OleDbException (0x80040e14): INSERT INTO 语句的语法错误。]
System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(OleDbHResult hr) +1084268
System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult) +247
System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult) +194
System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& executeResult) +58
System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method) +167
System.Data.OleDb.OleDbCommand.ExecuteReader(CommandBehavior behavior) +116
System.Data.OleDb.OleDbCommand.ExecuteReader() +6
About.insert_Click(Object sender, EventArgs e) in d:\简历\About.aspx.cs:28
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +118
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +112
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5563
#15
你把语句往数据库里一粘就知道哪错了
#16
我X这SQL语句写得真特么的艺术
#17
SQL语句中的values后面的每一个值,如果是字符的,都用'括起来;如果是日期型的,用#括起来;如果是数字,就不用改了。
#18
string sql = "插入语句“
插入语句具体是什么?不可能是这4个汉字吧
插入语句具体是什么?不可能是这4个汉字吧
#19
Sql = " insert into 表XX set ......"
#20
监控你的sql语句 复制下来 你的sql string
然后在access 里执行该语句 找到错误改下
然后在access 里执行该语句 找到错误改下
#21
.ExecuteReader
#22
我也觉得是这里用错了,既然是insert 为啥用read
#23
insert语句你好歹贴出来呀
#24
你到是把sql贴出来
#25
这楼主也是气死人