public partial class Form7 : Form
{
private MySqlDataAdapter da;
private MySqlConnection conn;
BindingSource bsource = new BindingSource();
DataSet ds = null;
string sql;
public Form7()
{
InitializeComponent();
}
private void LoadData()
{
string connectionString = "Data Source=localhost;database=d1; uid=root; password=123;port=3307;";
conn = new MySqlConnection(connectionString);
sql = "SELECT Name, Address, id, Status FROM t1";
da = new MySqlDataAdapter(sql, conn);
conn.Open();
ds = new DataSet();
MySqlCommandBuilder commandBuilder = new MySqlCommandBuilder(da);
da.Fill(ds, "Orders");
bsource.DataSource = ds.Tables["Orders"];
dgv.DataSource = bsource;
}
}
它给了我一个错误调用:
dgv does not exist in the current context
我能做些什么来修复它?我应该使用任何软件包或其他东西吗?