SQL Server 2005 connection thru Visual Studio 2005 failing.

  • SQL connection string from web.config:

    add

    key="conString" value="server=dbh_mpstrasser;uid=mpstrasser;pwd=island09!;database=PRAXIS"

    When issuing the conn.Open(); command I receive the following error message: +  base {"Invalid operation. The connection is closed."} System.SystemException {System.InvalidOperationException}

    Of course it is closed and I am issuing an open command. 

    I am thinking there is a problem with the connection string.

    This is my first attempt at connection to SQL Server 2005 database. I am able to bring up  SQL Server Management Studio and connect using the same userid/password combination.

     

  • This was removed by the editor as SPAM

  • Hello,

    1. Did you create a connection object before trying to open it?

    2. Try the connection string from VBscript to make sure connection string works independently from you .NET application. let us know if you need an example.

    Regards,Yelena Varsha

  • I ended up using this connection string:

    <

    add key="conString" value="Data Source=DBH_MPSTRASSER;Initial Catalog=PRAXIS;user id=mpstrasser;password=island09!;Integrated Security=True;Trusted_Connection=Yes"/>

     

    and it was successful.

    Do I need to close this somehow?

     

  • Yes, you should close connections if you don't need them anymore.There is an overhead when esteblishing a new connection so close your connection only when the task for this connection is accomplished.

    Or you can use MARS (Multiple Active Recordsets) feature of ADO.NET and SQL Server 2005 to use the same connection to return multiple recordsets. See

    http://msdn2.microsoft.com/en-us/library/ms130978(SQL.90).aspx

    Using ADO with SQL Native Client  

    Regards,Yelena Varsha

  • Visual Studio 2005 and SQL 2005 are tighly integrated. One need not write any connection string. When you configure the data source, the connection string is automatically crated. But due to bugs in Visula Studio 2005, the connection may fail now and then

    V.Kadal Amutham

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply