I had tried to set the configuration string within the Windows Form Designer
area and only succeeded in creating more problems. I put this same code
behind a load button and that took care of this issue for me.
Dim sServer as sting
Dim sWorkstation as string
sServer = Me.ServerName.Text
sWorkstation = Me.Workstation.Text
Me.SqlConnection1.ConnectionString = "workstation id=" + sWorkstation +
";packet size=4096;integrated security=SSPI;data source=" + sServer +
";persist security info=False;initial catalog=SigVerify"
If anyone knows a problem with assigning a Server in this manner let me
know; otherwise this seems to work just fine.
> Oscar,
>
[quoted text clipped - 13 lines]
> >
> > Oscar R. Espinosa
Oscar_Uio - 21 Sep 2005 10:36 GMT
Hi HollyylloH,
In your code you need use the Namespace System.Configuration
Me.SqlConnection1.ConnectionString =
System.Configuration.ConfigurationSettings.AppSettings("ConnectionString").ToString
that line, will read from your configuration file the connection
string. Then when you need to modify your conection string you have to
modify your configuration file.
This a example of a configuration file, that is a xml file. In your
project you have to add a configuration file , in the solution explorer
, add new file --> select application configuration file. This will
create a new file named app.config, in this file you must create a new
tag on this way.
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>
<!-- Configuración SQL Server -->
<add key="ConnectionString" value="Integrated Security=False;User
ID=User;Password=pass;Initial Catalog=DatabaseName;Data
Source=Server"/>
</appSettings>
</configuration>
I hope it can be helpfull to you.
Regards,
Oscar R. Espinosa