Wednesday, August 31, 2011

Working with SqlServer using Microsoft Enterprise Library

Microsoft Enterprise Library provide good solution for your database connection
Download Microsoft Enterprise Library 5.0

1. Modify your web.config file

2. import class library

3. Create accesses which related with your database table

4. Usage

i - Execute your sql query

ii - Execute your Stored Procedure

iii - Execute your Stored Procedure with output parameters

iv - ExecuteSprocAccessor use for retrieve the list of data

Tuesday, August 30, 2011

Write a Stored Procedure

This is basic thing, how to insert data using stored procedure. There are 4 fields I used in my User table (Id,UserName,Password,DateCreated).

:- not return a count value
:- return a value in primary key field which related with the newly inserted row
GETDATE() :- get the sql server time

Save Your Data in Current work space

Best method is using a view state

1. create a class in business layer
2. create a variable in list type 

3. create a new object in page load

4. Insert data to view state

Monday, August 29, 2011

Find all sql servers which are conecting to your network

1. Create a object to SqlDataSourceEnumerator class

 2. Fill the ArrayList