Hello All,
I am using VS 2010, C# windows forms. I am trying to connect VS to SQL server and display the data of the selected table in the DataGrid. I am connecting to SQL server using windows login. Unfortunately,it is showing error near Initial Catalog. The error states: "ArgumentException was unhandled: Unknown connection option in the connection string: initial catalog".
Below is my code:
private void button2_Click(object sender, EventArgs e)
{
SqlCeConnection con = new SqlCeConnection("Data Source=MyPC;Initial Catalog=Example;Integrated Security=True");
con.Open();
SqlCeDataAdapter sda = new SqlCeDataAdapter("select * from Student", con);
DataTable dt = new DataTable();
sda.Fill(dt);
dataGridView1.DataSource = dt;
}Please tell me where I am gone wrong and what I need to correct.
Regards,
Humaira.