Connectivity between SQL and ASP.NET

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rajkumarvasan
    New Member
    • Aug 2006
    • 1

    Connectivity between SQL and ASP.NET

    Inorder to fetch data from SQL database...i have written the following scripts...but it is showing errors which i am unable to debug..pls help me with this..

    Public Class Form1

    Private Sub Form1_Load(ByVa l sender As System.Object, ByVal e As System.EventArg s) Handles MyBase.Load
    <%@ Import Namespace="Syst em.Data.OleDb"% >

    <script runat="server">

    sub Page_Load
    Dim dbconn, sql, dbcomm, dbread, datasource
    dbconn = New sqlDbConnection ("Provider=Micr osoft.Jet.OLEDB .4.0")
    datasource=" & server.mappath( "conn\userdetai ls.mdb"))
    dbconn.Open()
    sql = "SELECT * FROM userdetails"
    dbcomm = New OleDbCommand(Sq l, dbconn)
    dbread = dbcomm.ExecuteR eader()
    End Sub
    </script>
    End Class
  • Enyi
    New Member
    • Jul 2006
    • 38

    #2
    What error do you get?

    Comment

    • angsuman chakraborty
      New Member
      • Aug 2006
      • 1

      #3
      Well, I think if u use sqldata provider then in the connection your provider should be sql connection, not OLEDB.

      Comment

      • Enyi
        New Member
        • Jul 2006
        • 38

        #4
        Well, I think if u use sqldata provider then in the connection your provider should be sql connection, not OLEDB.
        Well spotted, I never noticed. You know ... it could be the other way round :)

        Comment

        • bhar
          Banned
          New Member
          • Apr 2006
          • 37

          #5
          Hi,

          Note:

          When we use a SqlConnectio, you don't have to specify a provider, because the class talks directly to the SQL Server API.

          Regards
          bhar
          [Link Removed]
          Last edited by Frinavale; Apr 27 '07, 02:49 PM. Reason: Link was removed because it is considered spam and its content is not typical HTML

          Comment

          Working...