Results 1 to 2 of 2

Thread: Connecting to SQL Server from ADO.Net

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jun 2002
    Location
    Reading
    Posts
    70

    Connecting to SQL Server from ADO.Net

    Can anyone show me an example of how to connect to SQL server and retrieve a recordset for my asp.net page?

    Cheers.

  2. #2
    Member
    Join Date
    Dec 2000
    Posts
    53
    Dim strConn as string
    Dim strSql as string

    strConn = "connection string"
    strSql = "Sql statement"

    Dim Conn as new sqlClient.SqlConnection(strConn)
    Dim adptExample as new sqlClient.dataAdapter(strSql,strConn)
    Dim ds as new dataset
    adptExample.fill(ds)

    this will give you your dataset which you then can bind to a control or if you want to can access through code.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width