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. General Programming
  3. C#
  4. ODBC Connection Problem

ODBC Connection Problem

Scheduled Pinned Locked Moved C#
databasehelpjavasql-serversysadmin
8 Posts 7 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
    mjawadkhatri
    wrote on last edited by
    #1

    Hi. I try to connect sql server 2005 through OBDC connection bt i face a error please give me some solution, i face this error ERROR [08001] [Microsoft][ODBC SQL Server Driver][DBNETLIB]SQL Server does not exist or access denied. ERROR [01000] [Microsoft][ODBC SQL Server Driver][DBNETLIB]ConnectionOpen (Connect()). my Coding is OdbcConnection conn = new OdbcConnection("Driver={SQL Server};Server=test;UID=sa;PWD=java;");// test is my ODBC connection name string query = "INSERT INTO test VALUES ('" + textBox1.Text + "','" + textBox2.Text + "')"; OdbcCommand cmd = new OdbcCommand(query, conn); try { conn.Open(); cmd.ExecuteNonQuery(); MessageBox.Show("Record Inserted."); } finally { conn.Close(); }

    A R S M Y 5 Replies Last reply
    0
    • M mjawadkhatri

      Hi. I try to connect sql server 2005 through OBDC connection bt i face a error please give me some solution, i face this error ERROR [08001] [Microsoft][ODBC SQL Server Driver][DBNETLIB]SQL Server does not exist or access denied. ERROR [01000] [Microsoft][ODBC SQL Server Driver][DBNETLIB]ConnectionOpen (Connect()). my Coding is OdbcConnection conn = new OdbcConnection("Driver={SQL Server};Server=test;UID=sa;PWD=java;");// test is my ODBC connection name string query = "INSERT INTO test VALUES ('" + textBox1.Text + "','" + textBox2.Text + "')"; OdbcCommand cmd = new OdbcCommand(query, conn); try { conn.Open(); cmd.ExecuteNonQuery(); MessageBox.Show("Record Inserted."); } finally { conn.Close(); }

      A Offline
      A Offline
      Abhinav S
      wrote on last edited by
      #2

      Are you sure your user name and password are correct? The database name appears to be missing as well.

      M 1 Reply Last reply
      0
      • A Abhinav S

        Are you sure your user name and password are correct? The database name appears to be missing as well.

        M Offline
        M Offline
        mjawadkhatri
        wrote on last edited by
        #3

        thanks for reply. yes username and password is correct. where i put database name???

        B 1 Reply Last reply
        0
        • M mjawadkhatri

          Hi. I try to connect sql server 2005 through OBDC connection bt i face a error please give me some solution, i face this error ERROR [08001] [Microsoft][ODBC SQL Server Driver][DBNETLIB]SQL Server does not exist or access denied. ERROR [01000] [Microsoft][ODBC SQL Server Driver][DBNETLIB]ConnectionOpen (Connect()). my Coding is OdbcConnection conn = new OdbcConnection("Driver={SQL Server};Server=test;UID=sa;PWD=java;");// test is my ODBC connection name string query = "INSERT INTO test VALUES ('" + textBox1.Text + "','" + textBox2.Text + "')"; OdbcCommand cmd = new OdbcCommand(query, conn); try { conn.Open(); cmd.ExecuteNonQuery(); MessageBox.Show("Record Inserted."); } finally { conn.Close(); }

          R Offline
          R Offline
          Rajesh Anuhya
          wrote on last edited by
          #4

          go through this like this may help u http://connectionstrings.com/sql-server-2005[^]

          Rajesh B --> A Poor Workman Blames His Tools <--

          1 Reply Last reply
          0
          • M mjawadkhatri

            Hi. I try to connect sql server 2005 through OBDC connection bt i face a error please give me some solution, i face this error ERROR [08001] [Microsoft][ODBC SQL Server Driver][DBNETLIB]SQL Server does not exist or access denied. ERROR [01000] [Microsoft][ODBC SQL Server Driver][DBNETLIB]ConnectionOpen (Connect()). my Coding is OdbcConnection conn = new OdbcConnection("Driver={SQL Server};Server=test;UID=sa;PWD=java;");// test is my ODBC connection name string query = "INSERT INTO test VALUES ('" + textBox1.Text + "','" + textBox2.Text + "')"; OdbcCommand cmd = new OdbcCommand(query, conn); try { conn.Open(); cmd.ExecuteNonQuery(); MessageBox.Show("Record Inserted."); } finally { conn.Close(); }

            S Offline
            S Offline
            Som Shekhar
            wrote on last edited by
            #5

            mjawadkhatri wrote:

            OdbcConnection conn = new OdbcConnection("Driver={SQL Server};Server=test;UID=sa;PWD=java;");

            try this: OdbcConnection conn = new OdbcConnection("DSN=test;UID=sa;PWD=java;"); this is assuming that you have created a DSN entry with name test.

            1 Reply Last reply
            0
            • M mjawadkhatri

              Hi. I try to connect sql server 2005 through OBDC connection bt i face a error please give me some solution, i face this error ERROR [08001] [Microsoft][ODBC SQL Server Driver][DBNETLIB]SQL Server does not exist or access denied. ERROR [01000] [Microsoft][ODBC SQL Server Driver][DBNETLIB]ConnectionOpen (Connect()). my Coding is OdbcConnection conn = new OdbcConnection("Driver={SQL Server};Server=test;UID=sa;PWD=java;");// test is my ODBC connection name string query = "INSERT INTO test VALUES ('" + textBox1.Text + "','" + textBox2.Text + "')"; OdbcCommand cmd = new OdbcCommand(query, conn); try { conn.Open(); cmd.ExecuteNonQuery(); MessageBox.Show("Record Inserted."); } finally { conn.Close(); }

              M Offline
              M Offline
              Morgs Morgan
              wrote on last edited by
              #6

              Try this to include your database nam:

              OdbcConnection cn= new OdbcConnection("Driver={SQL Server};Server=mySQLServer;UID=sa;
              PWD=myPassword;Database=Northwind;");

              Also make sure that your Sql Server 2005 allows remote connections because by default it doesn't!

              1 Reply Last reply
              0
              • M mjawadkhatri

                thanks for reply. yes username and password is correct. where i put database name???

                B Offline
                B Offline
                BoomRShine
                wrote on last edited by
                #7

                OdbcConnection conn = new OdbcConnection("Driver={SQL Server};Server=test;**DataBase=DataBaseName;**UID=sa;PWD=java;");

                1 Reply Last reply
                0
                • M mjawadkhatri

                  Hi. I try to connect sql server 2005 through OBDC connection bt i face a error please give me some solution, i face this error ERROR [08001] [Microsoft][ODBC SQL Server Driver][DBNETLIB]SQL Server does not exist or access denied. ERROR [01000] [Microsoft][ODBC SQL Server Driver][DBNETLIB]ConnectionOpen (Connect()). my Coding is OdbcConnection conn = new OdbcConnection("Driver={SQL Server};Server=test;UID=sa;PWD=java;");// test is my ODBC connection name string query = "INSERT INTO test VALUES ('" + textBox1.Text + "','" + textBox2.Text + "')"; OdbcCommand cmd = new OdbcCommand(query, conn); try { conn.Open(); cmd.ExecuteNonQuery(); MessageBox.Show("Record Inserted."); } finally { conn.Close(); }

                  Y Offline
                  Y Offline
                  yu jian
                  wrote on last edited by
                  #8

                  this[^]

                  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