1. First you need SQL connection string
2. Create an object of SqlConnection class as follows.
SqlConnection connection = new SqlConnection(connectionString)
3. Create an object of SQLCommand class as follows and assign query
SqlCommandcmd = new SqlCommand("Insert
4. Add parameters to it as follows.
cmd.Parameters.AddWithValues("@Name", “Sukesh Marla”);
cmd.Parameters.AddWithValues ("@Website", “www.Sukesh-Marla.com”);
5. Open the connection
6. Execute the query as follows
7. Close the connection
What about the single value selection from SQL table?
It will also be a 7 step functionality like above only difference will be 6th step will be changed to follow.
How to perform Database operations in MVC?
It will be same like we did above.
For technical trainings on various topics like WCF, MVC, Business Intelligence, Design Patterns, WPF, TFS and Basic fundamentals feel free to contact SukeshMarla@Gmail.com or visit www.sukesh-marla.com
Also see SQL Server interview questions video on trigger, inserted and deleted tables: -