两条sql语句合并,或同时执行 5
insertintoSell(CustomerID)values(selectCustomerIDfromCustomerwhereName="+"\'"+name+"\...
insert into Sell(CustomerID) values(select CustomerID from Customer where Name=" + "\'" + name + "\'"
"insert into Sell(Time) values('" + DateTime.Now.ToString() + "')"
因为数据库里面CustomerID和Time都不允许为空,这两条语句要同时执行,或者合并,求高手赐教啊~
insert into Sell(CustomerID,Time) values((select CustomerID from
Customer where Name='" + name + "'),'"+System.DateTime.Now.ToString()+"')
最终ok的是这个~虽然都没Ok~很感谢大家的回答, 展开
"insert into Sell(Time) values('" + DateTime.Now.ToString() + "')"
因为数据库里面CustomerID和Time都不允许为空,这两条语句要同时执行,或者合并,求高手赐教啊~
insert into Sell(CustomerID,Time) values((select CustomerID from
Customer where Name='" + name + "'),'"+System.DateTime.Now.ToString()+"')
最终ok的是这个~虽然都没Ok~很感谢大家的回答, 展开
4个回答
展开全部
就是传两个值而已:
insert into Sell(CustomerID,Time) values((select CustomerID from Customer where Name=" + "\'" + name + "\'"),DateTme.Now.ToString());
insert into Sell(CustomerID,Time) values((select CustomerID from Customer where Name=" + "\'" + name + "\'"),DateTme.Now.ToString());
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
insert into Sell(CustomerID)
(select CustomerID from Customer where Name=" + "\'" + name + "\'"
UNION ALL
insert into Sell(Time) values('" + DateTime.Now.ToString() + "')")
(select CustomerID from Customer where Name=" + "\'" + name + "\'"
UNION ALL
insert into Sell(Time) values('" + DateTime.Now.ToString() + "')")
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
nsert into Sell(CustomerID,Time) values(select CustomerID from Customer where Name=" + "\'" + name + "\'", DateTime.Now)
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
sell(1,2)values(1,2)
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询