1.
SqlConnection con = new SqlConnection(sqlconnstr);
con.Open();
string sql = "insert into [Record] select * from Item where Item_id='" + Item_id + "';
delete from Item where Item_id='" + Item_id + "' ";
SqlCommand cmd = new SqlCommand(sql, con);
SqlDataReader dr = cmd.ExecuteReader();如何判断sql是否执行成功呢?2.
string sql2 = "insert into [Account] select Item_id,Price,'" + Convert.ToInt32(Price) * 0.2 + "' from [Item] where Item_id='" + Item_id + "'";这个语句执行了没显示出错,但在Account表里也找不到记录。不知道是哪里出错了。
SqlConnection con = new SqlConnection(sqlconnstr);
con.Open();
string sql = "insert into [Record] select * from Item where Item_id='" + Item_id + "';
delete from Item where Item_id='" + Item_id + "' ";
SqlCommand cmd = new SqlCommand(sql, con);
SqlDataReader dr = cmd.ExecuteReader();如何判断sql是否执行成功呢?2.
string sql2 = "insert into [Account] select Item_id,Price,'" + Convert.ToInt32(Price) * 0.2 + "' from [Item] where Item_id='" + Item_id + "'";这个语句执行了没显示出错,但在Account表里也找不到记录。不知道是哪里出错了。
解决方案 »
- 错误: 属性“WebForm_AutoFocus”的值为 null、未定义或不是 Function 对象
- 无刷新二级联动的取值
- System.NullReferenceException
- 如何用JS控制。NET控件?
- 拜求::DataGrid中分页中的编辑、删除功能的实现!!急急
- 新手求救:急!
- 本人原做网络路由的,现想学ASPNET,请高人指点方法和教材,以及调试环境
- 这什么这条sql server三表联合查询语句为什么不能把PRDT_CUS里表的符合条件的数据全部查出来?
- 我的IIS为什么不支持ASP.NET 1.1?????
- Font 'STSong-Light' with 'UniGB-UCS2-H' is not recognized.
- 急问:WIN7 homebasic版本怎么搭建ASP.NET服务器?
- 用SQL合并两张表放在一张新表中,该怎样?
没看懂你第二个 insert into tablename(filed1,filed2,filed3)values(value1,value2,value3)
添加表记录的格式是这样的
如果是报错,你的SQL语句必定会没有执行 不然就是执行了(但是执行了就不是说明你执行正确了)LZ可以在看看基本的SQL语法
感觉可能是 where 条件不对,你把语句放数据库里运行一下看看