Actually I am not able to get what the error is all about. So please guide me.
protected void Button1_Click(object sender, EventArgs e)
{
string connString = @"server = .\sqlexpress;integrated security = true;database = northwind";
string qry = @"select productname,unitprice from products";
SqlConnection conn = new SqlConnection(connString);
try
{
SqlDataAdapter da = new SqlDataAdapter();
da.SelectCommand = new SqlCommand(qry, conn);
da.Fill(ds, "products");
Console.WriteLine("Creating");
ds.WriteXml(@"c:\productstable.xml");
Console.WriteLine("Done");
}
catch (Exception e1)
{
Console.WriteLine("Error: " + e1);
}
finally
{
conn.Close();
}
}
Error!
The thread 0xba4 has exited with code 0 (0x0).
A first chance exception of type 'System.Data.SqlClient.SqlException' occurred in System.Data.dll
Roei BarPosted Oct 5, 2009, 9:49 AM
Kirtan PatelPosted Oct 6, 2009, 5:08 AM
and Dont Forget to mark "Do you like answer" please it will give me some credits :)
Shital MandlechaPosted Oct 6, 2009, 12:19 AM
Even though i am using Try-Catch block, it is still giving the error.
Thanks in advance.