Forum

Number Of Page View:100,000+/Months
LOGIN |New User

Reply

How to querying in ADO.Net, when using SqlCommand?
Instantiate a new command with a query and connection
SqlCommand cmd = new SqlCommand("select CategoryName from Categories", conn);
Call Execute reader to get query results
SqlDataReader rdr = cmd.ExecuteReader(); 
Passing the command string and connection object to the constructor.  Then we obtain a SqlDataReader object by calling the ExecuteReader method of the SqlCommand object, cmd.