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. .NET (Core and Framework)
  4. remote access to sql server 2000 by c#

remote access to sql server 2000 by c#

Scheduled Pinned Locked Moved .NET (Core and Framework)
csharpsysadmindatabasesql-servervisual-studio
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.
  • H Offline
    H Offline
    H R
    wrote on last edited by
    #1

    hi I want to connect to a sqlserver instance on another computer in the workgroup network. my program is win application with c# VS.NET 2008 and SQL Server 2000. what settings are needed for my sqlserver instance and my application? can you help me?

    H.R

    G 1 Reply Last reply
    0
    • H H R

      hi I want to connect to a sqlserver instance on another computer in the workgroup network. my program is win application with c# VS.NET 2008 and SQL Server 2000. what settings are needed for my sqlserver instance and my application? can you help me?

      H.R

      G Offline
      G Offline
      Greg Chelstowski
      wrote on last edited by
      #2

      You need to create a Login on the sql server, apply permissions to it (Server roles, User Mapping, etc) and then in your application create a connection string for that server, e.g.

      string ConnectionStr = "data source=FriendsServerName;initial catalog=TheDataBase;User ID=YourLogin;Password=12345";

      Using that connection string connect to your friend's sql server. That should do the trick. It does on SQL Server 2005 anyway.

      var question = (_2b || !(_2b));

      H 1 Reply Last reply
      0
      • G Greg Chelstowski

        You need to create a Login on the sql server, apply permissions to it (Server roles, User Mapping, etc) and then in your application create a connection string for that server, e.g.

        string ConnectionStr = "data source=FriendsServerName;initial catalog=TheDataBase;User ID=YourLogin;Password=12345";

        Using that connection string connect to your friend's sql server. That should do the trick. It does on SQL Server 2005 anyway.

        var question = (_2b || !(_2b));

        H Offline
        H Offline
        H R
        wrote on last edited by
        #3

        thanks, I did them but I could not to connect. ---------------------------------- my application: VS.NET 2008-C# my DB: SQL Server 2000 Personal Edition my OS: Win XP Profesional sp3 ---------------------------------- I have done these steps: 1. in target sql server instance: Enterprise Manager -> server -> right click -> Properties -> Connections tab -> tick: -allow other sql servers to connect remotely to this sql server using RPC -enforce distributed transactions 2. in target sql server instance: Enterprise Manager -> server -> right click -> Properties -> General tab -> Network Configuration... button -> enabling TCP/IP 3. in target sql server instance: Enterprise Manager -> server -> right click -> Properties -> Security tab -> Authentication -> SQL Server and Windows 4. I created a New Login in target sql server instance: Name=admin , Password=1001 , SQL Server Authentication , Database=Exam 5. my SqlConnection in application: "Server=192.168.0.205\\MYSQLSRV; Initial Catalog=Exam; Integrated Security=False; Persist Security Info=False; User ID=admin;Password=1001"; 6. I removed anti virus softwares and turned off Windows Firewall. 7. I tested both of my computers to ping to another But yet I have an error: an error was occured while establishing a connection to the server. when connecting to sql server 2005, this failure may be caused by the fact under the default settings sql server dose not allow remote connections. (provider:sql network interfaces, error:26-error locating server/instance specified) ---------------------------------- can any one help me ?

        H.R

        G 1 Reply Last reply
        0
        • H H R

          thanks, I did them but I could not to connect. ---------------------------------- my application: VS.NET 2008-C# my DB: SQL Server 2000 Personal Edition my OS: Win XP Profesional sp3 ---------------------------------- I have done these steps: 1. in target sql server instance: Enterprise Manager -> server -> right click -> Properties -> Connections tab -> tick: -allow other sql servers to connect remotely to this sql server using RPC -enforce distributed transactions 2. in target sql server instance: Enterprise Manager -> server -> right click -> Properties -> General tab -> Network Configuration... button -> enabling TCP/IP 3. in target sql server instance: Enterprise Manager -> server -> right click -> Properties -> Security tab -> Authentication -> SQL Server and Windows 4. I created a New Login in target sql server instance: Name=admin , Password=1001 , SQL Server Authentication , Database=Exam 5. my SqlConnection in application: "Server=192.168.0.205\\MYSQLSRV; Initial Catalog=Exam; Integrated Security=False; Persist Security Info=False; User ID=admin;Password=1001"; 6. I removed anti virus softwares and turned off Windows Firewall. 7. I tested both of my computers to ping to another But yet I have an error: an error was occured while establishing a connection to the server. when connecting to sql server 2005, this failure may be caused by the fact under the default settings sql server dose not allow remote connections. (provider:sql network interfaces, error:26-error locating server/instance specified) ---------------------------------- can any one help me ?

          H.R

          G Offline
          G Offline
          Greg Chelstowski
          wrote on last edited by
          #4

          Erm, it seems fine, except:

          H.R wrote:

          5. my SqlConnection in application: "Server=192.168.0.205\\MYSQLSRV; Initial Catalog=Exam; Integrated Security=False; Persist Security Info=False; User ID=admin;Password=1001";

          Well, that should be your connection string, not the actual connection, as in:

          private void ConnectToDb()
          {
          SqlConnection sqlConn = new SqlConnection("Server=192.168.0.205\\MYSQLSRV; Initial Catalog=Exam; Integrated Security=False; Persist Security Info=False; User ID=admin;Password=1001");

          sqlConn.Open(); // debug here. If THIS throws an exception, well, i can't help you

          sqlConn.Close(); //if it doesn't, you're good to go.

          }

          Test it like that. If this is how you used it, though, I honestly do not know what is wrong. One more thing... i understand you added a login to the server instance... but DID you actually add a user to the database you want them to use? You'll find a "Users" folder in Databases/YourDb/Security/Users That should help. I think.

          var question = (_2b || !(_2b));

          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