Click here to Skip to main content
15,887,676 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I wonder why we have to write all the code (like I have below) to make dataset and tableadapters in ASP.Net.
VB
Dim conStr As String = "Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\dbTest.mdf;Integrated Security=True;User Instance=True"
    Dim sqlQry As String = "SELECT * FROM tblTest"
Dim dAdt As New SqlDataAdapter(sqlQry, conStr)
Dim dSet As New DataSet()
dAdt.Fill(dSet, "tblTest")


Is there any designing way like we do in winforms, just by adding binding source and then adding dataset and table adapter?

Thanks
Posted
Updated 6-Sep-11 5:08am
v2

1 solution

The code which you have written seems to be correct. If you run, dataset will be fill by the data. After that you can associate this DataSet with ASP.NET DataControl and do the DataBind. Let say for GridView,
GridView1.DataSource=dsl
GridView1.DataBind()

Yes, you are looking for doing the stuff from design view, you can do that. GridView has a Smart Tag, ( > Symbol in DesingView ) Click on that, select data source and follow the instruction.
 
Share this answer
 
Comments
Furqan Sehgal 6-Sep-11 11:17am    
Thanks !
Furqan Sehgal 6-Sep-11 12:12pm    
How can I use it as dSet.tables("tblNew").rows(0).items(0)
etc.?
Abhijit Jana 6-Sep-11 12:19pm    
You can on the same you that you have specified. Just check for the syntax in vb.net.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900