Question

Locked

SQL Connection String

By jeffreyalejo ·
I have created an application using Visual Studio with a SQL database. I tried to run the program simultaneously with the help of my friend. The problem I encountered is that, the last application who tries to connect to the database receives this error message: "Not allowed to change the 'ConnectionString' property. The connection's current state is open."

It seems like whenever the connection's state is open it can never be opened again by another application unless the connection's state is close.

Can you help me solve this issue? I'm a newbie and your help is highly appreciated. Thank you in advance.

This conversation is currently closed to new comments.

4 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Answers

Collapse -

I'm scratching my head here trying to figure out what you've

by Tony Hopkinson In reply to SQL Connection String

done.

Look at when the connection get's opened and closed.

The error is sayng you are trying to chnage a connectionstring on an open connection. The ony way I know you can get that in another instance of the application, is to share the connection.

It's get roundable, in that you can test the status of the connection before trying to mess with it, but if it's a shared connection, you should e connecting to the dll/app with it in not direct to the db

Collapse -

Sounds like record locking

by Slayer_ In reply to SQL Connection String

What is your connection string, please reply with it, you may be locking the records.

Collapse -

Here is my connection string

by jeffreyalejo In reply to Sounds like record lockin ...

ConnectToSQL("MyDataBase", "MyTable")

dbConnection.ConnectionString=Connectionstring
dbConnection.Open()

===>Some codes here

dbConnection.Close()

Here is the sample of the connection string I used. MyDataBase is the Database Name and MyTable is the Table Name.

Back to Software Forum
4 total posts (Page 1 of 1)  

Related Discussions

Related Forums