大学IT网 - 最懂大学生的IT学习网站! QQ资料交流群:367606806
当前位置:大学IT网 > ASP.NET技巧 > asp.net(C#)写SQL语句技巧

asp.net(C#)写SQL语句技巧

关键词:asp.netC#SQL语句  阅读(618) 赞(11)

[摘要]本文是对asp.net(C#)写SQL语句技巧的讲解,对学习ASP.NET编程技术有所帮助,与大家分享。

/*添加SQL*/
string fields = "";
string values = "";
fields += "xm"; values += "'" + Request.Form["xm"].ToString() + "'";
fields += ",xb"; values += ",'" + Request.Form["xb"].ToString() + "'";
fields += ",sfz"; values += ",'" + Request.Form["sfz"].ToString() + "'";
fields += ",dzyj"; values += ",'" + Request.Form["dzyj"].ToString() + "'";
sql = "insert into EKECMS_EKETEAM (" + fields + ") values (" + values + ")";

/*修改SQL*/
sql = "updateEKECMS_EKETEAM set ZDMJ='" + Request.Form["h1"].ToString() + "'";
sql += ",jglx='" + Request.Form["h2"].ToString() + "'";
sql +=" where pid in (" + Request.Form["id"].ToString() + ")";



相关评论