int cartCusid = Convert.ToInt32(Session["cusid"]);
int cartPid = Convert.ToInt32(Request["pid"]);
DataSet shopinfo = DB.reDs("select count(*) from porder where opid=" + cartPid + " and ocid=" + cartCusid + "");
if (shopinfo.Tables[0].Rows[0][0].ToString() == "0")
{
DataSet ds = DB.reDs("select pname,pprice from pinfo where pid=" + cartPid + " ");
string pname = ds.Tables[0].Rows[0][0].ToString();
string pprice = ds.Tables[0].Rows[0][1].ToString();
DB.reDs("insert into porder values ( '1','"+cartPid+" ','"+cartCusid+" ','"+ pprice +" ','"+ pname +"')"); //应该是这句错了~ }sql 语句搞不定了~大虾麻烦帮助一下下~~~ 数据库里分别是 int,int,int,float,char(20)~~
int cartPid = Convert.ToInt32(Request["pid"]);
DataSet shopinfo = DB.reDs("select count(*) from porder where opid=" + cartPid + " and ocid=" + cartCusid + "");
if (shopinfo.Tables[0].Rows[0][0].ToString() == "0")
{
DataSet ds = DB.reDs("select pname,pprice from pinfo where pid=" + cartPid + " ");
string pname = ds.Tables[0].Rows[0][0].ToString();
string pprice = ds.Tables[0].Rows[0][1].ToString();
DB.reDs("insert into porder values ( '1','"+cartPid+" ','"+cartCusid+" ','"+ pprice +" ','"+ pname +"')"); //应该是这句错了~ }sql 语句搞不定了~大虾麻烦帮助一下下~~~ 数据库里分别是 int,int,int,float,char(20)~~
解决方案 »
- 300分的贴子了,还不能解决?帮忙解决的,全分!谢谢
- COMException (0x80004005),请教
- winform控件问题
- exe 编译成dll
- showModalDialog弹出页面中使用javascript:location.replace问题
- Access中,数据类型为"自动编号",新值为"随机"的时候,产生的值会出现复重吗?
- 想用c#做一个邮件服务器,请问有什么好的资料啊?
- 简单问题!!关于上穿控件的使用,在线等,马上结帖!!
- C#调用VC编写的DLL时的问题!!!!!急急急急急!!!!!
- 如何在GridView中后台添加“修改”列,并放到显示数据的最右边
- C#odbcDataReader的问题
- httpWebRequest上传时异常 基础连接已关闭 发送时发生错误
ToString()一下试试
(
"insert into porder(字段1,字段2) values({0},'{1}'),字段1的值,字段2的值 ",
);
改写下你的SQL语句看看
"insert into porder (字段1,字段2,字段3,字段4,字段5) values (1," +cartPid+ "," +cartCusid+ "," + pprice + ",'" + pname +"')"SQL中数字型不要用单引号引起来
估计里面直接使用SqlDataAdapter.Fill(),看看有没有其它的用来执行返回bool的~
另参数建议用SqlParameter