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
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Connection Via DSN in VB.Net

Connection Via DSN in VB.Net

Scheduled Pinned Locked Moved Database
csharpdatabasesysadminhelp
5 Posts 4 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.
  • M Offline
    M Offline
    MODI_RAHUL
    wrote on last edited by
    #1

    in vb.net when we create connection string we want dsn name in the connection string i want connection via sqlserver please suggest me what connection string i write notify i don't want server name and database name in the connection string. please help me :^)

    A 1 Reply Last reply
    0
    • M MODI_RAHUL

      in vb.net when we create connection string we want dsn name in the connection string i want connection via sqlserver please suggest me what connection string i write notify i don't want server name and database name in the connection string. please help me :^)

      A Offline
      A Offline
      Andy Brummer
      wrote on last edited by
      #2

      Since a DSN is part of ODBC configuration you need to use the ODBC data provider which will reduce your performance connecting to SQL server. And OLEDB option is to use a UDL file look under Storing Connection Strings on this page http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnbda/html/daag.asp[^]. Anothe option would be to encrypt the server and database name in a string and add the other information in at runtime.


      I can imagine the sinking feeling one would have after ordering my book, only to find a laughably ridiculous theory with demented logic once the book arrives - Mark McCutcheon

      M 1 Reply Last reply
      0
      • A Andy Brummer

        Since a DSN is part of ODBC configuration you need to use the ODBC data provider which will reduce your performance connecting to SQL server. And OLEDB option is to use a UDL file look under Storing Connection Strings on this page http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnbda/html/daag.asp[^]. Anothe option would be to encrypt the server and database name in a string and add the other information in at runtime.


        I can imagine the sinking feeling one would have after ordering my book, only to find a laughably ridiculous theory with demented logic once the book arrives - Mark McCutcheon

        M Offline
        M Offline
        miah alom
        wrote on last edited by
        #3

        If you create a DSN called abcd, string myConnectionString ="DSN=abcd;UID=root;PWD=root"; OdbcConnection MyConn; OdbcCommand MyCmd = new OdbcCommand(); MyConn = new OdbcConnection(myConnectionString); MyConn.Open(); MyCmd.Connection = MyConn; StringBuilder SQL = new StringBuilder(); SQL.Append("SELECT "); SQL.Append("*"); SQL.Append("FROM "); SQL.Append("Authors"); MyCmd.CommandText = SQL.ToString(); OdbcDataReader result = MyCmd.ExecuteReader(CommandBehavior.CloseConnection); int nResultCount = 0; while (result.Read()) { ++nResultCount; }

        A 1 Reply Last reply
        0
        • M miah alom

          If you create a DSN called abcd, string myConnectionString ="DSN=abcd;UID=root;PWD=root"; OdbcConnection MyConn; OdbcCommand MyCmd = new OdbcCommand(); MyConn = new OdbcConnection(myConnectionString); MyConn.Open(); MyCmd.Connection = MyConn; StringBuilder SQL = new StringBuilder(); SQL.Append("SELECT "); SQL.Append("*"); SQL.Append("FROM "); SQL.Append("Authors"); MyCmd.CommandText = SQL.ToString(); OdbcDataReader result = MyCmd.ExecuteReader(CommandBehavior.CloseConnection); int nResultCount = 0; while (result.Read()) { ++nResultCount; }

          A Offline
          A Offline
          Andy Brummer
          wrote on last edited by
          #4

          thanks. :confused:


          I can imagine the sinking feeling one would have after ordering my book, only to find a laughably ridiculous theory with demented logic once the book arrives - Mark McCutcheon

          A 1 Reply Last reply
          0
          • A Andy Brummer

            thanks. :confused:


            I can imagine the sinking feeling one would have after ordering my book, only to find a laughably ridiculous theory with demented logic once the book arrives - Mark McCutcheon

            A Offline
            A Offline
            Anonymous
            wrote on last edited by
            #5

            :rolleyes:

            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