connection string
-
Hi Im havin problems with my connection to my databases. I have a default connection string hardcoded in the appconfig file. I have a main form where i use opendialog to connect to another database of my choice. Everything works fine on this form, it connects to the new selected database. BUT now as soon as i go to a child form, it seems to loose that connection to the selected database and then makes use of the default hard coded string in the appconfig file. How do i keep the new selected connection over all my forms? Please if anyone could help me..would greatly appreciate it. Thanks
-
Hi Im havin problems with my connection to my databases. I have a default connection string hardcoded in the appconfig file. I have a main form where i use opendialog to connect to another database of my choice. Everything works fine on this form, it connects to the new selected database. BUT now as soon as i go to a child form, it seems to loose that connection to the selected database and then makes use of the default hard coded string in the appconfig file. How do i keep the new selected connection over all my forms? Please if anyone could help me..would greatly appreciate it. Thanks
With no code we can't tell where the error is. However, if you create a static string variable in your application for the connection string and use it instead of the configuration connection string (only using the configuration string on start up) then it will likely avoid your issue.
Need custom software developed? I do C# development and consulting all over the United States.
If you don't ask questions the answers won't stand in your way.
Doing a job is like selecting a mule, you can't choose just the front half xor the back half so when you ask me to do a job don't expect me to do it half-assed. -
With no code we can't tell where the error is. However, if you create a static string variable in your application for the connection string and use it instead of the configuration connection string (only using the configuration string on start up) then it will likely avoid your issue.
Need custom software developed? I do C# development and consulting all over the United States.
If you don't ask questions the answers won't stand in your way.
Doing a job is like selecting a mule, you can't choose just the front half xor the back half so when you ask me to do a job don't expect me to do it half-assed.Thanks for the response. Did what you said in another project, where i had programmatically created my dataset,binding source and table adapters etc. it worked 100 %. but the problem with this project is that i drag and dropped the components. And now when I call the tableadapters.fill() method on the child form, in the autogenerated designer code, it gets its connection string from
ProjectName.Properties.Settings.Default.StaffConnectionString
which is in the app.config file. Is this one of the limitations of using drag-and-drop components?Or is there a way of working around this? I really hope there is a way around cos this is going to require alot of recoding. Thanks again for the response..