private void btnsave_Click(object sender, System.EventArgs e)
{
//===修改记录===
string strsql,smallid;
smallid=TextBox3.Text;
//(1)
//TextBox1.Text;标题
//FreeTextBox1.Text;内容 //strsql="select * from New where newid="+smallid;
//(new link()).Uxsql(strsql,"New");
怎么将(1)这两个字段更新到New数据库中去? }
{
//===修改记录===
string strsql,smallid;
smallid=TextBox3.Text;
//(1)
//TextBox1.Text;标题
//FreeTextBox1.Text;内容 //strsql="select * from New where newid="+smallid;
//(new link()).Uxsql(strsql,"New");
怎么将(1)这两个字段更新到New数据库中去? }
解决方案 »
- TreeView 加载时报脚本错误
- Microsoft SharePoint 2003如何发布asp.net网站
- .net 添加序列号
- SQL SERVER服务器上的数据库可以备份到本地吗?
- 时间转换
- 1G电子书看光算你强(刚才发错地址了 :) )继续散分
- 资源文件的使用问题
- 谁有DundasWebChart 4.0的安装时用户和密码?
- Owc11 Oracle10g/11g 在VS2008中展示时的错误,有兴趣的朋友进来看看?
- 请问如何实现二次查询?
- 一个调用javascript的超简单问题请教高手:::response.write可以直接调用前台javaScript函数吗?
- 发个200分贴子,讨论一下微软PetShop例子应该如何扩展
//连接本地计算机的MMS数据库
SqlConnection cn= new SqlConnection (strconn);
cn.Open ();
string mysql= "update //更新的sql语句";
//创建Command对象
SqlCommand cm=new SqlCommand (mysql,cn);
//执行ExecuteReader ()方法
SqlDataReader dr=cm.ExecuteReader ();
string strsql="Update New set 标题='"+ TextBox1.Text +"',内容='"+ FreeTextBox1.Text +"' where newid='"+ smallid +"'";
SqlCommand myCommand = new SqlCommand(strsql,myConnection);
myConnection.Open();
myCommand.ExecuteNonQuery();
string strsql="Update New set 标题=@Title,内容=@Content where newid=@ID";SqlCommand objComm = new SqlCommand(strsql,objConn);
objComm.Parameters.Add("@Title", TextBox1.Text);
objComm.Parameters.Add("@Content", FreeTextBox1.Text);
objComm.Parameters.Add("@ID", 值);objConn.Open()
objComm.ExecuteNonQuery()
objConn.Close()