none
connect my c# project to Database in network

    Question

  • how to connect my c# project to Database create with Sql 2000 in network

    i use

    <?xml version="1.0" encoding="utf-8" ?> 
    <configuration> 
        <configSections> 
        </configSections> 
        <connectionStrings> 
            <add name="Egyptic.Properties.Settings.EgypticConnectionString" 
                connectionString="Data Source=192.168.1.2;Initial Catalog=Egyptic;Integrated Security=True" 
                providerName="System.Data.SqlClient" /> 
        </connectionStrings> 
    </configuration> 

    but not connect to this address  192.168.1.2
    Sunday, March 08, 2009 1:42 AM

Answers

  • i am sorry AlexBB for trouble

    i install windows xp and when i open firewall everything work and connect with database with this method

    connectionString=" Data Source=Ip Address ; Initial Catalog=DataBase; Integrated Security=True ; user name=sa "

    thanks AlexBB for your time

    • Marked as answer by Harry Zhu Tuesday, March 17, 2009 12:50 AM
    Monday, March 16, 2009 3:13 PM

All replies

  • The next connection string used TCIP/IP and a specific IP address:

    Data Source=192.162.1.100,1433;Network Library=DBMSSOCN;
    Initial Catalog=Northwind;User ID=sa;Password=;

    AlexB
    Sunday, March 08, 2009 1:54 AM
  • thanks AlexBB

    i will try use tcip/ip

    Sunday, March 08, 2009 1:59 AM
  • Calling an SQL connection from a remote machine:

    connectionString="Data Source=remote_machine;UID=your_username;PWD=your_password;Initial Catalog=your_database"

    Don't recall the source.

    Also.


    AlexB
    Sunday, March 08, 2009 2:06 AM
  • <?xml version="1.0" encoding="utf-8" ?> 
    <configuration> 
        <configSections> 
        </configSections> 
        <connectionStrings> 
            <add name="Egyptic.Properties.Settings.EgypticConnectionString" 
                connectionString="Data Source=192.162.1.4,1433 ; Network Library=DBMSSOCN ;Initial Catalog=Egyptic;Integrated Security=True" 
                providerName="System.Data.SqlClient" /> 
        </connectionStrings> 
    </configuration> 


    I try in me ip address but found this error



    // 
    System.Data.SqlClient.SqlException was unhandled
      Message="An error has occurred while establishing a connection to the server.  When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: TCP Provider, error: 0 - A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.)"
      Source=".Net SqlClient Data Provider"
      ErrorCode=-2146232060
    //
    Sunday, March 08, 2009 2:10 AM
  • sory i dont see you 2  response
    i will try
    Sunday, March 08, 2009 2:12 AM
  •  The error you've got is common. It means you haven't set up Sql Server properly. First you should make sure the ports are defined for Sql Server. Secondly all three protocols are enabled but VIA disabled. Thirdly SqlBrowser service must be running. You also should make sure you can make connection locally first from another application, not SSMS.
    AlexB
    • Proposed as answer by Harry Zhu Thursday, March 12, 2009 8:19 AM
    • Unproposed as answer by Ahmed_Soft3 Thursday, March 12, 2009 10:46 PM
    Sunday, March 08, 2009 2:21 AM
  •  In addition to all that you must make sure your DATA folder has appropriate permission for that user to acces it. It also should be ensured for each database mdf and log file if the permissions set to DATA did not propagate down the line.
    AlexB
    • Proposed as answer by Harry Zhu Thursday, March 12, 2009 8:19 AM
    • Unproposed as answer by Ahmed_Soft3 Thursday, March 12, 2009 10:46 PM
    Sunday, March 08, 2009 2:23 AM
  • thanks AlexBB

    i try

    connectionString=" Data Source=192.168.1.4 ; Initial Catalog=Egyptic;Integrated Security=True "

    but this ip is my computer ip and work 100 % but when try on network not work !!!

    i have test Ports 1433 , all three protocols are enabled but VIA disabled and SqlBrowser service are run

    Sunday, March 08, 2009 2:44 AM
  • Sory
    the three protocols are(named Pipes , Tcp/Ip ) only or ......

    Sunday, March 08, 2009 2:55 AM
  •  Shared Memory.
    AlexB
    Sunday, March 08, 2009 3:31 AM
  • Ahmed_Soft3 said:

    thanks AlexBB

    i try

    connectionString=" Data Source=192.168.1.4 ; Initial Catalog=Egyptic;Integrated Security=True "

    but this ip is my computer ip and work 100 % but when try on network not work !!!

    i have test Ports 1433 , all three protocols are enabled but VIA disabled and SqlBrowser service are run


    Permissions, permissions, permissions.

    AlexB
    Sunday, March 08, 2009 3:32 AM
  • this image from network configuration


    about permissions can you tell my how to change it

    thanks AlexBB For help
    Sunday, March 08, 2009 12:35 PM
  • Ahmed_Soft3 said:



    about permissions can you tell my how to change it

    thanks AlexBB For help



    Permissions on the server need to be changed.  Delete that link before some hacker sees it.
    Mark the best replies as answers. "Fooling computers since 1971."

    DUH!
    Sunday, March 08, 2009 2:08 PM
  • ok Rudedog2 but how to chang Permissions

    about link change or delete it in  your response
    • Marked as answer by Ahmed_Soft3 Friday, March 13, 2009 2:51 PM
    • Unmarked as answer by Ahmed_Soft3 Friday, March 13, 2009 2:51 PM
    Sunday, March 08, 2009 2:17 PM
  •  I told you how to change permissions. First of all you must have an account on the other machine equal in priviledge to the account you have on remote machine. That account (user name) must be included in Local Users and Groups. This account must be included as a user in Administrators group. An account for Sql Server (Sql Server System Administrator) must be set up in Local Users and Groups as an individual account and as a Group account. You must include yourself into this Groups (Sql Server System Administrator) as a user.

    Then you should go to the folder Program Files\Microsoft Sql Server\ and right click on the folder. Choose Properties=>Security tab=>Edit=>Add=> Add your sign in name to the list of users. Give yourself full rights. You will be pretty much set after that however there is also a chance that you may need to set up the same individually to any mdf and ldf file.

    Also there is a chance that you may get by by doing permissions on the folder DATA only which is narrower in scope or only on dadatabases themselves. I don't clearly recall.

    Also that thing about Sql Server System Administrator is mandatory for Sql Server Enterprise, Standard and Dev Editions but I am not sure about Sql Express.

    AlexB
    • Proposed as answer by Harry Zhu Thursday, March 12, 2009 8:18 AM
    • Unproposed as answer by Ahmed_Soft3 Thursday, March 12, 2009 10:46 PM
    Sunday, March 08, 2009 3:36 PM
  • Delete that link before some hacker sees it.

     RD2, you copied the link, how can he delete it now?
    AlexB
    Sunday, March 08, 2009 3:38 PM
  • Sory for delay response

    i have checked for permission and try to setup SQL Server Enterprise Manager in to computer and make new server registration and add server it realy see all database in sql and can edit and delete  but in me program cannot find database
    Thursday, March 12, 2009 9:40 PM
  •  You have to describe precisely point by point, better numbered, of what you've actually done in clear steps to be visualized. What do you mean: I checked for permissions? Where? What kind of permissions did you see? Etc, etc, etc. Many. many questions come with it.
    AlexB
    • Marked as answer by Ahmed_Soft3 Friday, March 13, 2009 12:29 AM
    • Unmarked as answer by Ahmed_Soft3 Friday, March 13, 2009 12:29 AM
    Friday, March 13, 2009 12:12 AM
  • 1- my authentication in sql is (sql server and windows ) and have no password

    2- i open (c:\Program Files\Microsoft Sql Server\ and right click on the folder. Choose Properties=>Security )tab but my system is fat32 so i remove sql and setup it in portion D (ntfs) to find Security tab and made what you say give full right

    3- open c# and try
    connectionString="Data Source=RemoteMachine ; Initial Catalog=DatabaseName ;User ID=sa"
     this code run on Local but on network this error found (i have share exe from sever)
    timeout expierd . the time timeout period elapsed prior to completion of the operation or server is not responding

    4-I install sql server in computer in network to test connection and make new server registration it really see server and database so the net work and server is working well


     

    Friday, March 13, 2009 12:54 AM
  •  on share i allow network user to change file
    Friday, March 13, 2009 12:57 AM
  •  so the net work and server is working well

    Then what is the problem? It is too bad you don't have NTFS. I don't really know how to handle it. It might be much simpler though, who knows. I am off for tonight.

    AlexB
    Friday, March 13, 2009 2:05 AM
  • thanks AlexBB for help

    my problem in connect c# with database in network i will try again and if i reach to solution i will told you
    Friday, March 13, 2009 2:58 PM
  •  On the network you have to have equal rights as a user. You must be an administrator everywhere.
    AlexB
    Friday, March 13, 2009 7:53 PM
  • the next step i will change windows because server is windows xp and client is windows 7
    i will setup xp in two pc and check for fierwall and told you the result

    Friday, March 13, 2009 9:54 PM
  • Ahmed_Soft3 said:

    the next step i will change windows because server is windows xp and client is windows 7
    i will setup xp in two pc and check for fierwall and told you the result


    Tha't quite a disparity. You are in teh 20th century with one foot and 22nd with another:) You straddle quite a universe. Definitely XP may create a problem. What is your impression of WIndows 7?

    AlexB
    Saturday, March 14, 2009 3:11 PM
  • windows 7 is really very speed and high security but still problem with old version of program
     
    in network found a lot of problem to make network so i  think problem in this windows (because high security and firewall)
    Saturday, March 14, 2009 3:47 PM
  •  You have to open TCP 1433 port for Sql Server on both sides.
    AlexB
    Saturday, March 14, 2009 5:46 PM
  •  i open net work configuration found tcp/ip enable and default port 1433

    can you upload sample test for program in c# connect with northwind if server ip is 192.168.1.2 and tcp port is 1433 

    if this test not run in client computer i will be sure the error in network or sql

    thanks AlexBB for all  help
    Saturday, March 14, 2009 10:59 PM
  •  I don't have a sample at hand. I used to but since then I reisntalled my OS because I moved to x64 and the old one was x86. There are tons of Sql Server Sample son MSDN. They are at CodePlex, a surrogate MS website mostly. Take a look at this. If you download and install AdventureWorks set of databases you will get numerous samples. I do have those. I just checked but could not see anything related but I was able to check the stuff very superficially without ever looking into the cs projects themselves. It is a geat stuff. You can google MSDN for more.
    AlexB
    Sunday, March 15, 2009 1:05 AM
  • i am sorry AlexBB for trouble

    i install windows xp and when i open firewall everything work and connect with database with this method

    connectionString=" Data Source=Ip Address ; Initial Catalog=DataBase; Integrated Security=True ; user name=sa "

    thanks AlexBB for your time

    • Marked as answer by Harry Zhu Tuesday, March 17, 2009 12:50 AM
    Monday, March 16, 2009 3:13 PM