how to use sqlcommand 1

how to use sqlcommand

 SqlConnection conn = new SqlConnection("Database=student;Server=.;user=sa;password=aaaaaaa");  
            conn.Open();  // Open the connection  
            // body    
            // body   
            conn.Close(); // Close the connection  

Here is what the above code is Doing:
1. Create a connection object.
2. Open the connection.
3. Do something with the connection.
4. Close the connection.

Similar Posts