-8

I have connected to my database using Data Connection Server Explorer and the same is added to my web.config as well. Now can someone tell me how to query it?

1

1 Answer 1

2

Sure, you could do this:

using (SqlConnection c = new SqlConnection(ConfigurationManager.ConnectionStrings["key_of_element"]))
{
    c.Open();
    using (SqlCommand cmd = new SqlCommand("SELECT * FROM Table"))
    {
        var reader = cmd.ExecuteReader();
        while (reader.Read())
        {
            // do something with the data
        }
    }
}
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.