Establishing a data connection for Asp.net page

Posted by dragon on Friday, 30 September 2011

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.

{ 0 comments... read them below or add one }

Post a Comment