没有吧,selcmd只是一个标识符,表面上看像是一个数据库内的储存过程。public void FuWuSheng()
{
string strConn = " Initial Catalog=SYXT;Data Source = LEIKE;User ID=sa;Password=sa";
SqlConnection conn = new SqlConnection();
conn.ConnectionString = strConn;
try
{
SqlCommand selcmd = new SqlCommand();
selcmd.Connection = conn;
selcmd.CommandText = "select * from GuYuan where GYID like '" + textBox3.Text + "%'";
SqlDataAdapter da = new SqlDataAdapter();
da.SelectCommand = selcmd;
DataSet ds = new DataSet();
da.Fill(ds,"GuYuan");
dataGrid1.DataSource = ds.Tables["GuYuan"];
conn.Open ();
conn.Close();
}
catch (Exception a)
{
MessageBox.Show (a.Message,"警告",MessageBoxButtons.OK,MessageBoxIcon.Asterisk);
}
}
IT618资讯网 提供服务端开发,前端开发,网页特效,热门开源系统研究,软件下载,站长建站,淘宝开店等学习资料.