Hi guys
I'm a newbie, and can't figure out the problem with the following code. I get the error inthe line in Bold. Please help
private void Form1_Load(object sender, EventArgs e)
{
con = new SqlConnection();
con.ConnectionString = "Data Source=.\\SQLEXPRESS;AttachDbFilename=C:\\Users\\KAMESH\\Documents\\Visual Studio 2010\\Projects\\bankDBApp\\bankDBApp\\bankAcc.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True";
con.Open();
MessageBox.Show("Connecting to SQL Database", "Connecting");
ds = new DataSet();
string sql = "SELECT * FROM AccountInfo";
da = new SqlDataAdapter(sql, con);
da.Fill(ds, "Accounts");
[B]foreach (DataRow dr in ds.Tables["AccountInfo"].Rows)[/B]
{
accountNumber = (string) dr["AccountNumber"];
cbAccountNumber.Text = accountNumber;
}
acc.AccountNumber = int.Parse(accountNumber);
cbAccountNumber.Items.Add(accountNumber);
con.Close();
}