1、增加:
insert into Lib_W(id,RFIDNo) values(" + i + ",'" + rfidNo + "');//i和EFIDNo是两个列名
2、删除:
delete Lib_W where id =@id;
delete 表名称 where 列名称 = 值;
3、修改:
update WMS_UserInfo set UserLevel=@UserLevel where UserID=@UserID;
update WMS_UserInfo set UserLevel=@UserLevel,Id=@Id where UserID=@UserID;
4、查询:
select * From Lib_W;
select [userName] from [tableA] where [...]
5、一般的数据库写入方式:
string constr = "Server=" + SQLIp + "; Pooling=true;Max Pool Size = 512;Database=" + SQLName + ";Uid=sa;Pwd=Sa123";
SqlConnection con = new SqlConnection(constr);
con.Open();
SqlCommand comm = new SqlCommand(sql, con);
comm.CommandText = sql;
//执行一个非查询sql语句,返回受影响的行数
int n = comm.ExecuteNonQuery();