CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 8 of 8
  1. #1
    Join Date
    Jul 2005
    Location
    Bremen, Germany
    Posts
    33

    system.transaction problem (c#, sql 2005)

    Hallo guys,
    I try out to use system.transactions, in which I use the msdn code .
    but I constantly get error 40: server does not allow remote connection.

    but I enabled the remote connection. I dont know whats the problem happening

    I hereby attach my project.
    pls help me in this regard.
    Attached Files Attached Files
    Last edited by kingslee; July 31st, 2006 at 02:47 PM.
    kings4u

  2. #2
    Join Date
    Apr 2002
    Location
    Egypt
    Posts
    2,210

    Re: system.transaction problem (c#, sql 2005)

    Which line of code that raised the exception ?
    did you try to connect using the SqlConnection without using a transcation ?
    this problem sohuld not happen if you connect to localhost !!
    anyway..try to use SQL Server Surface Area Configuration to allow remote connections.
    Hesham A. Amin
    My blog , Articles


    <a rel=https://twitter.com/HeshamAmin" border="0" /> @HeshamAmin

  3. #3
    Join Date
    Jul 2005
    Location
    Bremen, Germany
    Posts
    33

    Re: system.transaction problem

    thanks hspc for your reply.
    the problem comes in Connection1.open();
    its not able to open the connection .

    i enabled the remote host.
    and I test the sql connection by test connection.
    It works ..

    it gives the error 40 :
    I dont know what is the problem .. may in connection string

    please help me in this regard.

    mfg,
    kingsly
    kings4u

  4. #4
    Join Date
    Apr 2002
    Location
    Egypt
    Posts
    2,210

    Re: system.transaction problem

    Enabling remte connections with TCP/IP should solve this problem as mentioned in:
    http://www.datamasker.com/SSE2005_NetworkCfg.htm
    http://blogs.msdn.com/sql_protocols/...14/492616.aspx
    If I find another solution I'll post it..
    Hesham A. Amin
    My blog , Articles


    <a rel=https://twitter.com/HeshamAmin" border="0" /> @HeshamAmin

  5. #5
    Join Date
    Jul 2005
    Location
    Bremen, Germany
    Posts
    33

    Re: system.transaction problem

    thankyou hspc for ur reply.
    but I am stil struggling with my code ..
    I tried all the steps for the error.

    I dont know what i am doing wrong?

    can u show some sample running code ..
    kings4u

  6. #6
    Join Date
    Oct 2003
    Location
    .NET2.0 / VS2005 Developer
    Posts
    7,104

    Re: system.transaction problem

    he cant, there is no code that will run - your sql server is refusing to allow remote connections. have you configured your sql server to allow remote connections?
    "it's a fax from your dog, Mr Dansworth. It looks like your cat" - Gary Larson...DW1: Data Walkthroughs 1.1...DW2: Data Walkthroughs 2.0...DDS: The DataSet Designer Surface...ANO: ADO.NET2 Orientation...DAN: Deeper ADO.NET...DNU...PQ

  7. #7
    Join Date
    Jul 2005
    Location
    Bremen, Germany
    Posts
    33

    Re: system.transaction problem

    I configured my sql server .. according to the steps given in the link .
    and also I test the sql connection through the Data connection test connection.

    If I am doing something wrong, Please guide me ..

    -I configured the TCP/IP setting for remote connections , firewall disabled.

    why I asked the sample code is because It might be my "connection string" for the sqlconnection.

    waiting for reply from you guys
    kings4u

  8. #8
    Join Date
    Apr 2002
    Location
    Egypt
    Posts
    2,210

    Re: system.transaction problem

    Hi
    Connection! connection string does not have the username and password and also does not specify a trusted connection (windows authentication)
    try to change it to:
    Code:
    using(  SqlConnection connection1 = new SqlConnection("Data Source = localhost;Initial Catalog = pubs;Integrated Security=True;"))
    I wish this solves the problem ,, but I'm still confused about it becasue if this was the problem the error message should be (login failed for user XXX......)
    Anyway..try it and tell us...
    Hesham A. Amin
    My blog , Articles


    <a rel=https://twitter.com/HeshamAmin" border="0" /> @HeshamAmin

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured