SqlConnection conn = new SqlConnection("") ///数据库连接字符串
string sql = string,Format("update dbo set ('{0}','{1}','{2}','{3}') where ID= '{4}'",bookName,bookPrice,chubanshe,date)
SqlCommand cmd = new SqlCommand(sql,conn)
int result = cmd.ExecuteNonQuery//影响行数
if(result != null)
{Console.WriteLine("更新成功")}
else{Console.WriteLine("更新失败")}
删除的话把语句换成"delete from dbo where ID= '{0}'",bookID
添加:"insert into dbo values('{0}','{1}','{2}','{3}')",bookName,bookPrice,chubanshe,date
你sql写的有问题,你换上下面这句试试吧:string
sqlc="update
oa_user
set
mima='"+newpwd+"'
where
[name]='"+usename+"'
and
mima
='"+oldpwd+"'"
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)