ITCSAdmin
asked on
How do you change the ConnectionString for Entire Project?
How do I change the SQL ConnectionString when I am developing this appliaction in my Office and yet be able to deploy it at my customers location?
Below is the current code that was suppose to allow me to automatically switch between installed locations, but it is NOT. Is there something that I did or did not do when publishing the application or during the installation of the appliaction?
Below is the current code that was suppose to allow me to automatically switch between installed locations, but it is NOT. Is there something that I did or did not do when publishing the application or during the installation of the appliaction?
Module module_Lighthouse
Private Function GetData() As DataTable
Dim connectionString As String = String.Empty
#If Debug = True Then
connectionString = My.Settings.PLMConnectionStringDev 'Development connection string
#Else
connectionString = My.Settings.PLMConnectionStringDeploy 'Deployment connection string
#End If
Dim SQL As String = "SELECT * FROM myTable"
Dim table As New DataTable()
Dim adapter As New SqlClient.SqlDataAdapter(SQL, connectionString)
adapter.Fill(table)
adapter.Dispose()
Return table
End Function
End Module
If you do a simple test and use F5 and then CTRL+F5 to test it you see that works fine
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
MessageBox.Show(Information)
End Sub
End Class
Module abc
Public Function Information() As String
Dim result As String = String.Empty
#If Debug = True Then
result = "debug"
#Else
result = "release"
#End If
Return result
End Function
End Module
compile the application in release mode , default is debug mode
on your toolbar there should be a dropdown box with options debug and release. select release there and build the application and execute exe from release folder.
on your toolbar there should be a dropdown box with options debug and release. select release there and build the application and execute exe from release folder.
ASKER
jpaulino:
Sorry that it took so long for me to get back tp you, but I have ben busy with cleints and am trying to understand and then test what you sent me.
To answer your first response, I am not sure because I have not written any code to use the "connectionstring".
The following is a basic process that I am using to make my current appliaction:
I have used the process where you create your Windows Form, create your DataSet, Select the table in your Dataset, Set it to "Details" and drag and drop table onto form, arrange fields and labels, place the BindingNavigator on the bottom, Build, Publish and then deploy. It is when I deployed the application that I could NOT get the appliaction to connect to the clients SQL Server from there workstation.
The code that I have currently installed was given to me as a solution, but did not work. This is my very first application that I have ever built with a dependencies to a SQL Database. Otherwise I am very new, some VB6 work, But with VB9, ONLY Since December of 2008. I have taken on a very big project as my first project to develope.
Please feel free to ask questions, I am very glad to respond back.
Sorry that it took so long for me to get back tp you, but I have ben busy with cleints and am trying to understand and then test what you sent me.
To answer your first response, I am not sure because I have not written any code to use the "connectionstring".
The following is a basic process that I am using to make my current appliaction:
I have used the process where you create your Windows Form, create your DataSet, Select the table in your Dataset, Set it to "Details" and drag and drop table onto form, arrange fields and labels, place the BindingNavigator on the bottom, Build, Publish and then deploy. It is when I deployed the application that I could NOT get the appliaction to connect to the clients SQL Server from there workstation.
The code that I have currently installed was given to me as a solution, but did not work. This is my very first application that I have ever built with a dependencies to a SQL Database. Otherwise I am very new, some VB6 work, But with VB9, ONLY Since December of 2008. I have taken on a very big project as my first project to develope.
Please feel free to ask questions, I am very glad to respond back.
see the attached image, and I marked some area in red colored rectangle. you will find similar area on your toolbar. change the option to release there before building and deploying your application.
BuildModeChange.JPG
BuildModeChange.JPG
ASKER
The default toolbar for Visual Studio 2008 does NOT have that toolbar active. which toolbar do I need to activate? View - Toolbars - ?
it should be in view->toolbars->standard.
I am still working on visual studio 2005. if it is not there in standard toolbar in the try to find in the build menu->configuration manager or something like that. in that you can change the active configuration to release mode.
I am still working on visual studio 2005. if it is not there in standard toolbar in the try to find in the build menu->configuration manager or something like that. in that you can change the active configuration to release mode.
check this link on how to change mode,
http://msdn.microsoft.com/en-us/library/wx0123s5.aspx
http://msdn.microsoft.com/en-us/library/wx0123s5.aspx
ASKER
appari
I have read the link and for some reason my Visual Studio 2008 Professional does NOT give me that option on the page that they say it is. I also have checked every where and still have NOT fould that option.
Should I contact Micorsoft Technical Support or do you have another suggestion?
I have read the link and for some reason my Visual Studio 2008 Professional does NOT give me that option on the page that they say it is. I also have checked every where and still have NOT fould that option.
Should I contact Micorsoft Technical Support or do you have another suggestion?
may be missing something ,
can you take the screenshot and post it here
can you take the screenshot and post it here
Sorry for the delay ... busy week :)
One question: do you have used wizards to fill comboboxes, datagridviews, bindingsources, etc ? Because that way you have to change the connection of that binding.
One question: do you have used wizards to fill comboboxes, datagridviews, bindingsources, etc ? Because that way you have to change the connection of that binding.
usually i never use wizards, code it all myself. still i think its possible to change the connection details in code even for the controls generated using wizards.
I also don't use wizards but the are very usefull for those how are starting.
And it's possible to change the connection details for them.
And it's possible to change the connection details for them.
ASKER
jpaulino:
See my screen shot of Visual Studio 2008 Professional
Visual-Studio-2008---Project---S.JPG
See my screen shot of Visual Studio 2008 Professional
Visual-Studio-2008---Project---S.JPG
ASKER
jpaulino
I found part of my question and would like to update you on where I got the information. There is a big difference between Visual Studio 2005 and 2008. This is one of them. To deploy in VS 2005, you would just from you toolbar, change it from Debug to Deploy, but in VS 2008 you now have to due the following:
Watch the following Video http://windowsclient.net/l earn/video .aspx?v=14 636
This is the first part, Now the second is I need to be able to switch from SQL 2005 Standard (Development) to either SQL 2005 Express or SQL 2008 Express (Deployment) ConnectionString or do I have to change my project to ONLY use either SQL Standard or SQL Express for the entire project.
Also, this solution needs to work across the entire project, multiple Tables, multiple Forms, Multiple DataSets, etc..
Have any suggestions or thoughts?
REMEMBER I am using Visual Studio 2008 Professional!!!
I found part of my question and would like to update you on where I got the information. There is a big difference between Visual Studio 2005 and 2008. This is one of them. To deploy in VS 2005, you would just from you toolbar, change it from Debug to Deploy, but in VS 2008 you now have to due the following:
Watch the following Video http://windowsclient.net/l
This is the first part, Now the second is I need to be able to switch from SQL 2005 Standard (Development) to either SQL 2005 Express or SQL 2008 Express (Deployment) ConnectionString or do I have to change my project to ONLY use either SQL Standard or SQL Express for the entire project.
Also, this solution needs to work across the entire project, multiple Tables, multiple Forms, Multiple DataSets, etc..
Have any suggestions or thoughts?
REMEMBER I am using Visual Studio 2008 Professional!!!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Sorry it's being very difficult to read all the email and reply to all :(
Glad you have solved your problem and sorry once again!
jpaulino
Glad you have solved your problem and sorry once again!
jpaulino
Are you using that variable "connectionString " in more places ?