DataGridView,DataBind()
-
Hello, I'm using VS2008 (C#). i built a desktop application that doing few type of query's and save the results to CSV file. now, i want also to see the result in the DataGridView. i understand the logic, and i understand that i have to use in my code something like the follow lines: (i cant see the "DataBind" Method!!)
public void ExecuteFromBox(string ExecuteFromFile,string timeNow)
{
string conStr = String.Format(@"UID=very_Funny;PWD=hahahahaha;InitialCatalog=hahahahahahaha;Data Source=hahahahahaha");
Form1 frmain = new Form1();
SqlConnection conn = new SqlConnection(conStr);
conn.Open();
SqlCommand cmd = new SqlCommand(@ExecuteFromFile, conn);
MessageBox.Show(cmd.CommandText);
DataSet ds = new DataSet();
//SqlDataAdapter ad = new SqlDataAdapter(cmd);
SqlDataReader reader = cmd.ExecuteReader();
frmain.DTResults.DataSource = reader;
frmain.DTResults.DataBind(); // i cant find this Method!!!
conn.Close();
}is there any suggestion?? how can i add the DataBind Method? Thank you :-)
-
Hello, I'm using VS2008 (C#). i built a desktop application that doing few type of query's and save the results to CSV file. now, i want also to see the result in the DataGridView. i understand the logic, and i understand that i have to use in my code something like the follow lines: (i cant see the "DataBind" Method!!)
public void ExecuteFromBox(string ExecuteFromFile,string timeNow)
{
string conStr = String.Format(@"UID=very_Funny;PWD=hahahahaha;InitialCatalog=hahahahahahaha;Data Source=hahahahahaha");
Form1 frmain = new Form1();
SqlConnection conn = new SqlConnection(conStr);
conn.Open();
SqlCommand cmd = new SqlCommand(@ExecuteFromFile, conn);
MessageBox.Show(cmd.CommandText);
DataSet ds = new DataSet();
//SqlDataAdapter ad = new SqlDataAdapter(cmd);
SqlDataReader reader = cmd.ExecuteReader();
frmain.DTResults.DataSource = reader;
frmain.DTResults.DataBind(); // i cant find this Method!!!
conn.Close();
}is there any suggestion?? how can i add the DataBind Method? Thank you :-)