Linking WebPage to DataBase? RRS feed

  • Question

  • Hi,


    I'm really new to ASP.NET 2.0, but not to web programming or storing data.  I've set up an ASP survey and have inserted form objects to gather data.  I've set up the database with corresponding column names that match the objects in the web page. 


    How do I get the web page to connect to the database and store data from the objects?  I've clicked the box in the database view that allows inserting, updating, deleting, etc.  I'm trying to test the survey before uploading it. I've tried storing data several times, but something is not set correctly.


    Do I need to declare and dimension all the variables inside the sub for the submit button in VB?   


    Any help or pointers in the right direction would help.  Thanks

    Monday, August 27, 2007 2:32 AM

All replies

  • hii

    If u wanna sent ur data to database from ur page you can go for dataset. If u r using vs2005 go to solution explorer and and right click to ur project u get add item then from the objets add dataset.

    after adding right click the dataset to add dataadpter the wizard will open follow the instructions and the adapter will be added.

    now from the code(using c#)


    testdataset.datatable dt =new testdataset.datatable();

    testdatast.datatableadpter da=new testdataset.datatableadapter();





    if i miss something let me know.


    Monday, August 27, 2007 9:21 AM
  • Hi Avinob,


    After right-clicking the database, I don't see any options for adding a data adapter.  I had the database created already.  So when I right click it, there are no optiosn for adding anything. What am I missing?


    Wednesday, August 29, 2007 11:39 PM
  • hii WxMan,

    You have to go to the solution explorer not to the server explorer. in solution explorer you project folders and your aspx pages are present right click them and u got add new items from which u have to select dataset !

    try this out and i will tell u further Smile


    Thursday, August 30, 2007 5:17 AM
  • Thanks for the last post.  Maybe the problem is that I am using the Visual Web Developer 2005 Express Edition that came with my ASP.NET 2.0 Book (Scott Mitchell's).  Maybe it has less features or functionality..I don't know.


    At any rate, within the solution explorer, where the .aspx tabs, .vb, database and so forth are displayed, there is nothing that I can right click on that brings up the ability to add a dataset object.  The very top tab lets me add an item, but it contains only about 3 things...xml, sql, text, and so forth.  But in right-clicking everything I can find in every window does not bring up the ability to add a dataset item.  Maybe the Express Edition does not allow this? 


    Do I have to have something other than the Express Edition of VS/Visual Web Developer to do what I want to do?


    Thanks for hanging in there....Alan

    Thursday, August 30, 2007 7:40 PM
  • Re your last post, Express edition is fine, you need to change from solution explorer window to database explorer window.

    There are tabs under instead of above!

    Thursday, August 30, 2007 8:45 PM
  • Avinob,...


    OK...I found the dataset icon went through the steps you specified with it.  Also added the data adapter. 


    I am working in vb.  Is the code inserted in Load Page in the .vb.aspx?


    What is next? 


    I've configured insert and update and tried running the page to see if data is written to the database, but no success so far.....WxMan

    Saturday, September 1, 2007 1:01 AM