Executing *.sql file form C#

Sometimes we need to run *.sql script from our application for installing data base. SqlCommand is not right for running installation script because installation script consists of DDL and GO command. Here we use smo library for executing *.sql script. For doing above operation we need to add following references Microsoft.SqlServer.ConnectionInfo Microsoft.SqlServer.Smo Took me a

Read More

My Short Note

Use Asp.net Session from Class Library (or Class Library Project) Add First we need to add System.Web as a reference on our project. System.Web.HttpContext.Current.Session[“MyVariable”]; System.Web.HttpContext.Current.Session(“MyVariable”); How to write connection string in web.config file At first we need to add following namespace using System.Collections.Generic; using System.Web.Configuration; Now use following code to write on web.config file Configuration

Read More