Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. Connect to a database with with a odbc connection

Connect to a database with with a odbc connection

Scheduled Pinned Locked Moved ASP.NET
databasecsharpasp-netcomquestion
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    gunnar66
    wrote on last edited by
    #1

    Hi Try to connect to a database with a odbc connection (system dsn) Dim connectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0; Ole DB Services=-4; DSN=NRS" Dim dbConnection As System.Data.IDbConnection = New System.Data.OleDb.OleDbConnection(connectionString) This will not work. why? I have tried this, this worked ok Dim connectionString As String ="Provider=Microsoft.Jet.OLEDB.4.0; Ole DB Services=-4; Data Source=C:\Inetpub\wwwroot\db1.mdb" Dim dbConnection As System.Data.IDbConnection = New System.Data.OleDb.OleDbConnection(connectionString) What should I do to get this right? I am useing ASP.NET and web matrix Regards Gunnar

    M 1 Reply Last reply
    0
    • G gunnar66

      Hi Try to connect to a database with a odbc connection (system dsn) Dim connectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0; Ole DB Services=-4; DSN=NRS" Dim dbConnection As System.Data.IDbConnection = New System.Data.OleDb.OleDbConnection(connectionString) This will not work. why? I have tried this, this worked ok Dim connectionString As String ="Provider=Microsoft.Jet.OLEDB.4.0; Ole DB Services=-4; Data Source=C:\Inetpub\wwwroot\db1.mdb" Dim dbConnection As System.Data.IDbConnection = New System.Data.OleDb.OleDbConnection(connectionString) What should I do to get this right? I am useing ASP.NET and web matrix Regards Gunnar

      M Offline
      M Offline
      minhpc_bk
      wrote on last edited by
      #2

      Hi there, If you want to use the system dsn, then you should go for the OdbcConnection instead of the OleDbConnection. You can take a look at the System.Data.Odbc Namespace[^]

      G 1 Reply Last reply
      0
      • M minhpc_bk

        Hi there, If you want to use the system dsn, then you should go for the OdbcConnection instead of the OleDbConnection. You can take a look at the System.Data.Odbc Namespace[^]

        G Offline
        G Offline
        gunnar66
        wrote on last edited by
        #3

        Hi Ok I will give it a try. But that is, OleDbConnection will not work with system dsn? Thx

        M 1 Reply Last reply
        0
        • G gunnar66

          Hi Ok I will give it a try. But that is, OleDbConnection will not work with system dsn? Thx

          M Offline
          M Offline
          minhpc_bk
          wrote on last edited by
          #4

          AFAIK the OleDbConnection in the .Net framework is not typically used with the system dns.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups