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. Unknown connection option in connection string: provider.

Unknown connection option in connection string: provider.

Scheduled Pinned Locked Moved C#
sysadmincsharpdatabasesecurity
8 Posts 3 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.
  • T Offline
    T Offline
    Tunisien86
    wrote on last edited by
    #1

    Hi guys, I develop a csharp smart device application In order to establish a TCP/IP connection to my .mdf database,I use the above connection string:

    string sConnection = "Provider=SQLOLEDB;Data Source=127.0.0.1,7438;Persist Security Info=True;Network Library=dbmssocn;Initial Catalog=GMAO;User ID=sa;Password=sa";

    where the Data source is the @of my server that I found due the netstat -an command:

    C:\Users\Admin>netstat -an

    Active Connections

    Proto Local Address Foreign Address State
    TCP 0.0.0.0:7 0.0.0.0:0 LISTENING
    TCP 0.0.0.0:9 0.0.0.0:0 LISTENING
    TCP 0.0.0.0:13 0.0.0.0:0 LISTENING
    TCP 0.0.0.0:17 0.0.0.0:0 LISTENING
    TCP 0.0.0.0:19 0.0.0.0:0 LISTENING
    TCP 0.0.0.0:80 0.0.0.0:0 LISTENING
    TCP 0.0.0.0:135 0.0.0.0:0 LISTENING
    TCP 0.0.0.0:445 0.0.0.0:0 LISTENING
    TCP 0.0.0.0:515 0.0.0.0:0 LISTENING
    TCP 0.0.0.0:990 0.0.0.0:0 LISTENING
    TCP 0.0.0.0:1433 0.0.0.0:0 LISTENING
    TCP 0.0.0.0:2103 0.0.0.0:0 LISTENING
    TCP 0.0.0.0:2105 0.0.0.0:0 LISTENING
    TCP 0.0.0.0:2107 0.0.0.0:0 LISTENING
    TCP 0.0.0.0:2383 0.0.0.0:0 LISTENING
    TCP 0.0.0.0:49152 0.0.0.0:0 LISTENING
    TCP 0.0.0.0:49153 0.0.0.0:0 LISTENING
    TCP 0.0.0.0:49154 0.0.0.0:0 LISTENING
    TCP 0.0.0.0:49155 0.0.0.0:0 LISTENING
    TCP 0.0.0.0:49156 0.0.0.0:0 LISTENING
    TCP 0.0.0.0:49159 0.0.0.0:0 LISTENING
    TCP 0.0.0.0:49160 0.0.0.0:0 LISTENING
    TCP 0.0.0.0:54667 0.0.0.0:0 LISTENING
    TCP 127.0.0.1:1434 0.0.0.0:0 LISTENING
    TCP 127.0.0.1:1801 0.0.0.0:0 LISTENING
    TCP 127.0.0.1:5679 0.0.0.0:0 LISTENING
    TCP 127.0.0.1:7438 0.0.0.0:0 LISTENING
    TCP 127.0.0.1:49172 127.0.0.1:49173 ESTABLISHE
    TCP 127.0.0.1:49173 127.0.0.1:49172 ESTABLISHE
    TCP 127.0.0.1:49185 127.0.0.1:49186 ESTABLISHE
    TCP 127.0.0.1:4918

    D W 2 Replies Last reply
    0
    • T Tunisien86

      Hi guys, I develop a csharp smart device application In order to establish a TCP/IP connection to my .mdf database,I use the above connection string:

      string sConnection = "Provider=SQLOLEDB;Data Source=127.0.0.1,7438;Persist Security Info=True;Network Library=dbmssocn;Initial Catalog=GMAO;User ID=sa;Password=sa";

      where the Data source is the @of my server that I found due the netstat -an command:

      C:\Users\Admin>netstat -an

      Active Connections

      Proto Local Address Foreign Address State
      TCP 0.0.0.0:7 0.0.0.0:0 LISTENING
      TCP 0.0.0.0:9 0.0.0.0:0 LISTENING
      TCP 0.0.0.0:13 0.0.0.0:0 LISTENING
      TCP 0.0.0.0:17 0.0.0.0:0 LISTENING
      TCP 0.0.0.0:19 0.0.0.0:0 LISTENING
      TCP 0.0.0.0:80 0.0.0.0:0 LISTENING
      TCP 0.0.0.0:135 0.0.0.0:0 LISTENING
      TCP 0.0.0.0:445 0.0.0.0:0 LISTENING
      TCP 0.0.0.0:515 0.0.0.0:0 LISTENING
      TCP 0.0.0.0:990 0.0.0.0:0 LISTENING
      TCP 0.0.0.0:1433 0.0.0.0:0 LISTENING
      TCP 0.0.0.0:2103 0.0.0.0:0 LISTENING
      TCP 0.0.0.0:2105 0.0.0.0:0 LISTENING
      TCP 0.0.0.0:2107 0.0.0.0:0 LISTENING
      TCP 0.0.0.0:2383 0.0.0.0:0 LISTENING
      TCP 0.0.0.0:49152 0.0.0.0:0 LISTENING
      TCP 0.0.0.0:49153 0.0.0.0:0 LISTENING
      TCP 0.0.0.0:49154 0.0.0.0:0 LISTENING
      TCP 0.0.0.0:49155 0.0.0.0:0 LISTENING
      TCP 0.0.0.0:49156 0.0.0.0:0 LISTENING
      TCP 0.0.0.0:49159 0.0.0.0:0 LISTENING
      TCP 0.0.0.0:49160 0.0.0.0:0 LISTENING
      TCP 0.0.0.0:54667 0.0.0.0:0 LISTENING
      TCP 127.0.0.1:1434 0.0.0.0:0 LISTENING
      TCP 127.0.0.1:1801 0.0.0.0:0 LISTENING
      TCP 127.0.0.1:5679 0.0.0.0:0 LISTENING
      TCP 127.0.0.1:7438 0.0.0.0:0 LISTENING
      TCP 127.0.0.1:49172 127.0.0.1:49173 ESTABLISHE
      TCP 127.0.0.1:49173 127.0.0.1:49172 ESTABLISHE
      TCP 127.0.0.1:49185 127.0.0.1:49186 ESTABLISHE
      TCP 127.0.0.1:4918

      D Offline
      D Offline
      dan sh
      wrote on last edited by
      #2

      Are you using SqlConnection? In that case you do not need to give "provider". If you are getting access denied errors, check if the server allows remote connections using TCP/IP and Server browser service is running. Also check if the provided credentials have access to the server.

      T 1 Reply Last reply
      0
      • D dan sh

        Are you using SqlConnection? In that case you do not need to give "provider". If you are getting access denied errors, check if the server allows remote connections using TCP/IP and Server browser service is running. Also check if the provided credentials have access to the server.

        T Offline
        T Offline
        Tunisien86
        wrote on last edited by
        #3

        Hi, I use sqlConnection because I need to connect to .mdf database in a smart device application.The server is local and allows TCP/IP connection.The server browser is running. U last sentence "Also check if the provided credentials have access to the server.",I don't understand it Thanks :) :)

        D 1 Reply Last reply
        0
        • T Tunisien86

          Hi, I use sqlConnection because I need to connect to .mdf database in a smart device application.The server is local and allows TCP/IP connection.The server browser is running. U last sentence "Also check if the provided credentials have access to the server.",I don't understand it Thanks :) :)

          D Offline
          D Offline
          dan sh
          wrote on last edited by
          #4

          Is that an attached DB file? Take a look at this[^] page. It shows all the options you have with SqlConnection.

          T 2 Replies Last reply
          0
          • D dan sh

            Is that an attached DB file? Take a look at this[^] page. It shows all the options you have with SqlConnection.

            T Offline
            T Offline
            Tunisien86
            wrote on last edited by
            #5

            Hi, Do u mean by attach database file by:join the database file to database field in sql server?If this,I do it. My code is below:

            private void Form6_Load(object sender, EventArgs e)
            {

                    string sConnection = "Data Source=127.0.0.1,1433;Persist Security Info=True;Initial Catalog=GMAO;User ID=sa;Password=sa";
                    string sSQL = "SELECT \[M-MO\] FROM Marge; ";
                    SqlConnection conn = new SqlConnection(sConnection);
                    SqlCommand comm = new SqlCommand(sSQL, conn);
                    SqlDataReader dr = null;
                    try
                    {
            
                        comm.Connection.Open();
                        dr = comm.ExecuteReader();
                        while (dr.Read())
                            comboBox1.Items.Add(dr\[0\]);
                    }
                    catch (SqlException ex)
                    {
                        //MessageBox.Show("connexion impossible");
                        MessageBox.Show(ex.Message);
                        return;
                    }
            
                    dr.Close();
                    comm.Connection.Close();
                }
            

            If the program connects to the server,it will fill the combobox with data of the select statement. But,the error"Specified sql server not found or access denied :(( lets me cry. Thanks

            1 Reply Last reply
            0
            • D dan sh

              Is that an attached DB file? Take a look at this[^] page. It shows all the options you have with SqlConnection.

              T Offline
              T Offline
              Tunisien86
              wrote on last edited by
              #6

              Hi, Thanks I depass the problem of the connexion to the server due to the DB File attachmen :laugh: Still now the problem in the filling of my combobox.In fact,no exception appears so connection to server works well.In other hand,nothing is added to my combobox. I try to replace my sqldatareader by sqldataset but still the same thing:

              string sConnection = "Data Source=127.0.0.1,1433;Persist Security Info=True;Initial Catalog=GMAO;User ID=sa;Password=sa";
              string sSQL = "SELECT com FROM energie; ";
              SqlConnection conn = new SqlConnection(sConnection);
              SqlCommand comm = new SqlCommand(sSQL, conn);
              DataSet ds = new DataSet();
              SqlCeDataAdapter da = new SqlCeDataAdapter();
              SqlDataReader dr = null;
              try
              {

                          comm.Connection.Open();
                          da.Fill(ds, "SQL Temp Table");
                          foreach(DataRow d in ds.Tables\[0\].Rows)
                          comboBox1.Items.Add(d.ToString());
                      }
                      catch (SqlException ex)
                      {
                          //MessageBox.Show("connexion impossible");
                          MessageBox.Show(ex.Message);
                          return;
                      }
              
                      dr.Close();
                      comm.Connection.Close();
                  }
              

              How do I depass that??? Thank u

              1 Reply Last reply
              0
              • T Tunisien86

                Hi guys, I develop a csharp smart device application In order to establish a TCP/IP connection to my .mdf database,I use the above connection string:

                string sConnection = "Provider=SQLOLEDB;Data Source=127.0.0.1,7438;Persist Security Info=True;Network Library=dbmssocn;Initial Catalog=GMAO;User ID=sa;Password=sa";

                where the Data source is the @of my server that I found due the netstat -an command:

                C:\Users\Admin>netstat -an

                Active Connections

                Proto Local Address Foreign Address State
                TCP 0.0.0.0:7 0.0.0.0:0 LISTENING
                TCP 0.0.0.0:9 0.0.0.0:0 LISTENING
                TCP 0.0.0.0:13 0.0.0.0:0 LISTENING
                TCP 0.0.0.0:17 0.0.0.0:0 LISTENING
                TCP 0.0.0.0:19 0.0.0.0:0 LISTENING
                TCP 0.0.0.0:80 0.0.0.0:0 LISTENING
                TCP 0.0.0.0:135 0.0.0.0:0 LISTENING
                TCP 0.0.0.0:445 0.0.0.0:0 LISTENING
                TCP 0.0.0.0:515 0.0.0.0:0 LISTENING
                TCP 0.0.0.0:990 0.0.0.0:0 LISTENING
                TCP 0.0.0.0:1433 0.0.0.0:0 LISTENING
                TCP 0.0.0.0:2103 0.0.0.0:0 LISTENING
                TCP 0.0.0.0:2105 0.0.0.0:0 LISTENING
                TCP 0.0.0.0:2107 0.0.0.0:0 LISTENING
                TCP 0.0.0.0:2383 0.0.0.0:0 LISTENING
                TCP 0.0.0.0:49152 0.0.0.0:0 LISTENING
                TCP 0.0.0.0:49153 0.0.0.0:0 LISTENING
                TCP 0.0.0.0:49154 0.0.0.0:0 LISTENING
                TCP 0.0.0.0:49155 0.0.0.0:0 LISTENING
                TCP 0.0.0.0:49156 0.0.0.0:0 LISTENING
                TCP 0.0.0.0:49159 0.0.0.0:0 LISTENING
                TCP 0.0.0.0:49160 0.0.0.0:0 LISTENING
                TCP 0.0.0.0:54667 0.0.0.0:0 LISTENING
                TCP 127.0.0.1:1434 0.0.0.0:0 LISTENING
                TCP 127.0.0.1:1801 0.0.0.0:0 LISTENING
                TCP 127.0.0.1:5679 0.0.0.0:0 LISTENING
                TCP 127.0.0.1:7438 0.0.0.0:0 LISTENING
                TCP 127.0.0.1:49172 127.0.0.1:49173 ESTABLISHE
                TCP 127.0.0.1:49173 127.0.0.1:49172 ESTABLISHE
                TCP 127.0.0.1:49185 127.0.0.1:49186 ESTABLISHE
                TCP 127.0.0.1:4918

                W Offline
                W Offline
                William Winner
                wrote on last edited by
                #7

                First, did you notice that when you wrote the connection string, you used a comma to identify the port instead of a colon?

                Data Source=127.0.0.1**,**7438

                Also, are you sure the SQL Server isn't listening on port 1434 or that it is running? If SQL server is listening on port 1433, then you need to use the port it's listening on.

                T 1 Reply Last reply
                0
                • W William Winner

                  First, did you notice that when you wrote the connection string, you used a comma to identify the port instead of a colon?

                  Data Source=127.0.0.1**,**7438

                  Also, are you sure the SQL Server isn't listening on port 1434 or that it is running? If SQL server is listening on port 1433, then you need to use the port it's listening on.

                  T Offline
                  T Offline
                  Tunisien86
                  wrote on last edited by
                  #8

                  Hi William, I just posted the solution:http://www.codeproject.com/Messages/3468528/Re-Unknown-connection-option-in-connection-string-.aspx[^] Thanks a lot if u try to help me to depass this new problem :) Note:Plz William how can I pass the solution of a thread I opened and all moderators who try to help me with their suggestions show this solution??? :)

                  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