国产一级a片免费看高清,亚洲熟女中文字幕在线视频,黄三级高清在线播放,免费黄色视频在线看

打開APP
userphoto
未登錄

開通VIP,暢享免費(fèi)電子書等14項(xiàng)超值服

開通VIP
c#更新數(shù)據(jù)庫中數(shù)據(jù)

c#更新數(shù)據(jù)庫中數(shù)據(jù)

moreover_0310級(jí)分類: C#/.NET語言被瀏覽366次2013.07.07

請(qǐng)微博專家回答檢舉

C#中更新一條數(shù)據(jù)庫記錄寫法為: SqlConnection conn = new SqlConnection(connStr); string cmd1 = "update userInfo set xc02='" + xxx + "' WHERE userName='" + cUser + "'"; SqlCommand sqlcmd = new SqlCommand(cmd1, conn);//conn為上面的連接; conn.Open(); sqlcmd.ExecuteNonQuery(); 但當(dāng)我要更新數(shù)據(jù)列很多的時(shí)候,這個(gè)update語句長得很難對(duì)哪個(gè)是哪個(gè)。 ASP中要清楚得多: set rs=server.createobject("adodb.recordset") sql="select * from [user] where userName='"&cUser&"'" rs.open sql,conn,1,3 if rs.eof then rs.addnew rs("userName")=username rs("passWord")=password rs("ask")=pwwt rs("answer")=pwda rs("zctime")=now() rs("vip")=0 rs.update C#中有沒有這樣的寫法,請(qǐng)給個(gè)例子,謝!
采納率:59%10級(jí)2013.07.08
SqlConnection conn = new SqlConnection(connStr); string sql= "update [userInfo] set xc02= @xc02,passWord = @password, ask = @ask WHERE userName= @username"; SqlCommand cmd = new SqlCommand(sql,conn) sqlParameter[] sqlParas = new sqlPararmeter[]{ new SqlParameter("@xc02",string xc02), new SqlParameter("@password",string password), new SqlParameter("@username",string username) } foreach(SqlParameter sp in sqlParas) { cmd.Parameters.add(sp); } conn.open(); cmd.ExecuteNonQuery();
本站僅提供存儲(chǔ)服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊舉報(bào)。
打開APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
萬能密碼是什么 菜鳥必讀
為動(dòng)態(tài)網(wǎng)站制作RSS內(nèi)容輸出的程序模版
新型萬能登陸密碼sql
Flash和ASP實(shí)現(xiàn)的用戶登錄/注冊(cè)程序
用PHP導(dǎo)出MySQL數(shù)據(jù)庫內(nèi)容為.sql文件
ASP+ACCESS SQL注射技巧小記
更多類似文章 >>
生活服務(wù)
分享 收藏 導(dǎo)長圖 關(guān)注 下載文章
綁定賬號(hào)成功
后續(xù)可登錄賬號(hào)暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服