请更正此 [英] Please correct this
本文介绍了请更正此的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
更正此
correct this
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.SqlClient;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
SqlDataAdapter da = new SqlDataAdapter();
SqlConnection con = new SqlConnection("Data Source=(local);Initial Catalog=sourav;Integrated Security=SSPI");
SqlCommand cmd = new SqlCommand("update friends set name=''Sachin'' where studentid=1");
DataSet ds = new DataSet();
da.UpdateCommand = cmd;
//da.Fill(ds, "friends");
da.Update(ds,"friends");
}
}
}
推荐答案
只需插入您的连接字符串和查询:
Just insert your connection string and your query:
<br />
SqlConnection con = new SqlConnection(@"Data Source=HEINZZ-PC\SQLEXPRESS;Initial Catalog=MyDB;Integrated Security=True");<br />
SqlCommand cmd = new SqlCommand("update Personel set Name=''Sachin'' where ID=1");<br />
cmd.Connection=con;<br />
con.Open();<br />
cmd.ExecuteNonQuery();<br />
con.Close();<br />
这篇关于请更正此的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文