phpeproject.ir
جمعه 14 تیر 1392, 21:23 عصر
دوستان چرا این کد کار نمیکنه
این کلاس
public DataSet gridbind(string myQuery)
{
con = new SqlConnection(@"Data Source=WEBENGIN-PC\SQLEXPRESS;Initial Catalog=gold;Integrated Security=True");
adp = new SqlDataAdapter(myQuery, con);
DataSet ds = new DataSet();
adp.Fill(ds);
con.Close();
return ds;
}
اینم کد با فراخوانی کلاس فقط بایند نمیشه
private void frm_goldtype_Load(object sender, EventArgs e)
{
conectionDB myGrid = new conectionDB();
dataGridView1.DataSource = myGrid.gridbind("select * from t_user");
dataGridView1.DataBinds();
}
این کلاس
public DataSet gridbind(string myQuery)
{
con = new SqlConnection(@"Data Source=WEBENGIN-PC\SQLEXPRESS;Initial Catalog=gold;Integrated Security=True");
adp = new SqlDataAdapter(myQuery, con);
DataSet ds = new DataSet();
adp.Fill(ds);
con.Close();
return ds;
}
اینم کد با فراخوانی کلاس فقط بایند نمیشه
private void frm_goldtype_Load(object sender, EventArgs e)
{
conectionDB myGrid = new conectionDB();
dataGridView1.DataSource = myGrid.gridbind("select * from t_user");
dataGridView1.DataBinds();
}