textbox的内容插入到sql数据库代码在怎么写
双击提交进入后台代码,代码怎么写,我的数据库名是Kpwang,数据表名是dsyl,标题列名是title内容列名是content,,,急急急。跪求教导...
双击提交进入后台代码,代码怎么写,我的数据库名是Kpwang,数据表名是dsyl,标题列名是title内容列名是content,,,急急急。跪求教导
展开
3个回答
展开全部
SqlConnection conn = new SqlConnection(数据库连接字符串);
conn.open();
SqlCommand cmd = new SqlCommand();
string str = string.Formart("insert into dsyl(title,content) values('{0}','{1}')",this.biaoti.text.toString(),this.neirong.text.toString());
cmd.CommandText = str;
cmd.Connection = conn;
cmd.ExecuteNonQuery();
conn.close;
conn.open();
SqlCommand cmd = new SqlCommand();
string str = string.Formart("insert into dsyl(title,content) values('{0}','{1}')",this.biaoti.text.toString(),this.neirong.text.toString());
cmd.CommandText = str;
cmd.Connection = conn;
cmd.ExecuteNonQuery();
conn.close;
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询