Posts

Showing posts from April, 2015

ASP.Net with MS SQL Database

Image
In this blog I'll explain how to create database in MSSQL and connect it to ASP.Net web application. 1.  Create a database Employee. Set identity to the ‘id’ column. This will auto increment the id by 1 each time when the record is added.  2. C reate a Stored Procedure called ‘AddEmployee’. Stored Procedures are queries that you can write once and execute multiple times.  Set the required parameters using following format: @parameter_name parameter_type (size) 3.  Create empty ASP.Net project using Visual Studio. 4.  Add ConnectionString attribute to the Web.config file to get connected with our database.  5.  Create a dbConnection.cs to get connection string from the Web.config file.  6.  Create Employee class. NOTE: If you are using AJAX this class might be a problem when the JSON object names are not matched with this object property names. So decorate the class properties with the JsonProperty attribute.