Sunday, September 5, 2010

TypeDataset

How to create typed Dataset
1>First create a table with sql server enterprise manager
Say we have created a table with name member which have a following filed
:=>PKID(Int),MemberID(bigint),Name(Varchar),Salary(float),SalaryType(bit).

2>Enter few records into the table.
3>Now open the visual studio .net editor.
4>Craete a new asp.net web site.
5>In Solution Explorer, right-click to add a new item, and select DataSet. Give it the name MemberDataSet.xsd. Visual Studio will recommend placing the DataSet file inside the App_Code folder, which you should allow it to do for you.
6>Now cancel the connection interface which will open as default.
7>Open the server explorer.drag table into the design window.
8>Now right ckick on the TableAdaptor=>click on configure.
9>Customize the query accordingly=>Click Next=>Specify the Method name=>Click next=>Click Next.
10>Now come to the code behind and add the following code.

The way out in which not need to create any connection.

the way out in which need to create connection.

//Person Table first row name collumn
//objDS.Person[0].Name = 1;
//It will generate compile time error.

No comments: