SqlConnection con = new SqlConnection("server=.; database = pubs; uid = sa; pwd = sa;");
con.Open();
SqlCommand cmd = new SqlCommand("select * from titles",con);
SqlDataReader dr = cmd.ExecuteReader();
this.dataGrid1.DataSource = dr;
dr.Close();
con.Close();报错~``错在哪??
con.Open();
SqlCommand cmd = new SqlCommand("select * from titles",con);
SqlDataReader dr = cmd.ExecuteReader();
this.dataGrid1.DataSource = dr;
dr.Close();
con.Close();报错~``错在哪??
this.DataGrid1.DataBind();