datagridview不显示数据库表中的数据
代码如下,如何解决呢。。。
private void Showdata()
{
SqlConnection myconn = new SqlConnection(constr);
mycon = new SqlConnection(constr);
string mysql = "select * from 用户信息表";
SqlDataAdapter myada = new SqlDataAdapter(mysql, mycon);
mytable = new DataTable();
myada.Fill(mytable);
dataGridView1.DataSource = mytable.DefaultView;
mycon.Close();
private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
{
pstr = mytable.Rows[e.RowIndex][0].ToString();
textBox1.Text = mytable.Rows[e.RowIndex][1].ToString();
textBox2.Text = mytable.Rows[e.RowIndex][2].ToString();
}