I need help with embedded sql and c#. How does C# implement embedded sql?
Embedded sql?
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Suthish NairPosted Dec 11, 2012, 3:15 PM
String connString = ConfigurationManager.ConnectionStrings["NorthwindConnectionString"].ToString();
String sSQL = "select * from dbo.Categories ";
using (SqlConnection conn = new SqlConnection(connString))
{
using (SqlCommand cmd = new SqlCommand())
{
conn.Open();
cmd.CommandText = sSQL;
cmd.Connection = conn;
using (SqlDataReader dr = cmd.ExecuteReader(System.Data.CommandBehavior.CloseConnection))
{
using (DataSet result = new DataSet())
{
result.Load(dr);
}
}
}
}