private void queryButton_Click(object sender, EventArgs e)
{
try
{
SqlConnection myconn = new SqlConnection("server=FDL;Integrated Security =SSPI;database=StroeOnline");
string Ssql = "select UserName from User where UserName='" + nameTextBox.Text.Trim() + "'";
SqlCommand cmd = new SqlCommand(Ssql,myconn);
myconn.Open ();
cmd.ExecuteNonQuery();
SqlDataAdapter sqlda = new SqlDataAdapter(Ssql,myconn);
DataTable ds = new DataTable();
sqlda.Fill(ds);
dataGridview1.DataSource=ds.DefaultView;
myconn.Close ();
}
catch
{
//MessageBox.Show(ee.Message,"错误的输入!");
}
finally
{
}
}
我的完整代码是这样的,但为什么还是显示不出来.
做个东西好多天了,一直卡在这里了.望指教啊