asp.net 的insert语句语法错误
老是提示insertinto语法错误。但找不到错在哪里stringnumber=this.number.Text;stringitemno=Request.QuerySt...
老是提示insert into 语法错误。但找不到错在哪里
string number = this.number.Text;
string itemno = Request.QueryString["item_no"];
string invno = this.inv_no.Text;
int paid = Convert.ToInt32(this.paid.Text);
int paid_rmb = 1 * paid;
string paid_unit = this.paid_unit.Text;
DateTime postdate = Convert.ToDateTime(this.post_date.Text);
OleDbConnection con = DB.createconnection();
con.Open();
OleDbCommand cmd3 = new OleDbCommand("insert into invoice (number,item_no,invoice_no,paid_rmb,paid,paid_unit,post_date) values ('" + number + "','" + itemno + "','" + invno + "','"+paid_rmb+"','"+paid+"','"+paid_unit+"','"+postdate+"')", con);
cmd3.ExecuteNonQuery(); 展开
string number = this.number.Text;
string itemno = Request.QueryString["item_no"];
string invno = this.inv_no.Text;
int paid = Convert.ToInt32(this.paid.Text);
int paid_rmb = 1 * paid;
string paid_unit = this.paid_unit.Text;
DateTime postdate = Convert.ToDateTime(this.post_date.Text);
OleDbConnection con = DB.createconnection();
con.Open();
OleDbCommand cmd3 = new OleDbCommand("insert into invoice (number,item_no,invoice_no,paid_rmb,paid,paid_unit,post_date) values ('" + number + "','" + itemno + "','" + invno + "','"+paid_rmb+"','"+paid+"','"+paid_unit+"','"+postdate+"')", con);
cmd3.ExecuteNonQuery(); 展开
展开全部
DateTime与string类型的要加引号,int类型的是不需要加引号的!
你的paid在上面声明的明轮坦明是int型的,但是你物桐铅在下面拼接的时候却加了单引号:(,'"+paid+"罩好',)! 还有:,'"+paid_rmb+"',
把单引号去掉应该就可以了!
你的paid在上面声明的明轮坦明是int型的,但是你物桐铅在下面拼接的时候却加了单引号:(,'"+paid+"罩好',)! 还有:,'"+paid_rmb+"',
把单引号去掉应该就可以了!
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
string number = this.number.Text;
string itemno = "";
if(Request.QueryString["item_no"基激]!="")
{
itemno=Request.QueryString["item_no"];
}
string invno = this.inv_no.Text;
int paid = Convert.ToInt32(this.paid.Text);
int paid_rmb = 1 * paid;
string paid_unit = this.paid_unit.Text;
DateTime postdate = Convert.ToDateTime(this.post_date.Text);
OleDbConnection con = DB.createconnection();
con.Open();
OleDbCommand cmd3 = new OleDbCommand("insert into invoice (number,item_no,invoice_no,paid_rmb,paid,paid_unit,post_date) values ('" + number + "','" + itemno + "','" + invno + "',"+paid_rmb+","蔽锋袜+paid+",'"+paid_unit+"','宏激"+postdate+"')", con);
cmd3.ExecuteNonQuery();
string itemno = "";
if(Request.QueryString["item_no"基激]!="")
{
itemno=Request.QueryString["item_no"];
}
string invno = this.inv_no.Text;
int paid = Convert.ToInt32(this.paid.Text);
int paid_rmb = 1 * paid;
string paid_unit = this.paid_unit.Text;
DateTime postdate = Convert.ToDateTime(this.post_date.Text);
OleDbConnection con = DB.createconnection();
con.Open();
OleDbCommand cmd3 = new OleDbCommand("insert into invoice (number,item_no,invoice_no,paid_rmb,paid,paid_unit,post_date) values ('" + number + "','" + itemno + "','" + invno + "',"+paid_rmb+","蔽锋袜+paid+",'"+paid_unit+"','宏激"+postdate+"')", con);
cmd3.ExecuteNonQuery();
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
首先是int 类型的不需要加'' 其他的你搜袜蠢的类型是否匹配我就不清楚啦 不行的话就如楼上所说好袜的世陪 输出一下 或者设置断点看看整个的sql语句
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
'"+paid_unit+"'让裂 '"+paid_rmb+"'滑猜为整型 去掉'坦让闭'
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
不妨输出sql 语句检查一下
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询