Thursday, October 15, 2009

Establishing a data connection for Asp.net page

With Visual Web Developer, from Microsoft:
  1. Create an ODBC data source for the database
  2. In default.aspx web form drag and drop a Gridview control
  3. Click on the top right of the Gridview control. Select "new data source". On the page will appear a window with various icons. Select "Database". Click OK.
  4. Now 'll appear SqlDataSource1 control. Click on "New connection" button.
  5. It'll appear a window. Click on Edit button and select "Other". In the label It'll appear ".Net Framework Data Provider for ODBC"
  6. Below click the option button "Use connection string". Click on "Generate.." button, and select the tab "Computer data source". Then select your data source name. Then OK. Next.
  7. Click on the "Specify a stored procedure or a customized SQL statement" option button. Otherwise you may get a token error message because of the square brackets for a string without white spaces.
  8. You may use "select" statement. Write the select statement. Next. Click on "Test query" button.
  9. Now you should see your table.
  10. For further test start the debug.

3 comments:

  1. Hello maybe is better to post some screenshots for the steps too

    I guess i can link this post to the next one with the DSN and firebird :) ?

    ReplyDelete
  2. Hello mariuz,
    may be we have encountered one the other earlier in the web.
    Just now I added two steps I unfortunately forgot in a first version of the "Howto create a DSN".
    As soon as I'll have the time I'll insert the screenshots you asked me.
    Goodbye.

    ReplyDelete
  3. Thank you , I have added to firebirdnews

    also these days people do screencasting and post it to youtube
    maybe when you have time (add it in the TODO list :))

    ReplyDelete