当前位置:编程学习 > C#/ASP.NET >>

请大神帮忙看一下access数据库的插入语句有什么问题?

刚学用c#操作access数据库,当用strSql1可以随时插入,但第二个却总提示Insert into语句有语法错误,请大神帮忙看看,谢谢!
                string strSql1 = string.Format("insert into score (Chinese,math,English,physical) values ('{0}','{1}','{2}','{3}')",易做图Info.Chinese,易做图Info.English,易做图Info.Math,易做图Info.physical);
                string strSql2 = string.Format("insert into score (Title,Authors,Affiliations,Source,Abstract,Language,DocumentType,PublicYear,Volume,Issue,BeginPage,EndPage,Pages,KeyWords,Numberofreferences) values ('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','{13}','{14}')",易做图Info.Title,易做图Info.Abstract,易做图Info.Affiliations,易做图Info.Source,易做图Info.Abstract,易做图Info.Language,易做图Info.DocumentType,易做图Info.PublicYear,易做图Info.Volume,易做图Info.Issue,易做图Info.BeginPage,易做图Info.EndPage,易做图Info.Pages,易做图Info.KeyWords,易做图Info.NumberofReferences);
                
OleDbCommand cmd = new OleDbCommand(strSql1, connection);
OleDbCommand cmd = new OleDbCommand(strSql2, connection);
                int num=cmd.ExecuteNonQuery(); --------------------编程问答-------------------- MessageBox.Show(strSql2)
看看内容里是不是有特殊字符
使用传参数


补充:.NET技术 ,  C#
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,