How do I change connection strings with csharp??

  • Thread starter Thread starter acool
  • Start date Start date
A

acool

I have been doing this with VB.Net for quite a while and NO problems. I
tried doing the same thingwith csharp and my Visual DataAdapter bomb when I
go back to the page. My code is as follows:


string strCRMUpdate = ini.ReadString("CRMCredentials", "CRMUpdate", "");
string strDefaultDB = ini.ReadString("CRMCredentials", "DefaultDB",
"Development");


this.ConnSQL.ConnectionString = "workstation id=M1;packet size=4096;user
id=sa;data source=MyServer;persist securi" +
"ty info=True;initial catalog=MyDB;password=mypass" +
"";


if (strDefaultDB == "Production")
{
this.ConnSQL.ConnectionString = strCRMUpdate;
}

then I get this error on the page:

An Error occured loading the document.
 
acool said:
I have been doing this with VB.Net for quite a while and NO problems. I
tried doing the same thingwith csharp and my Visual DataAdapter bomb when I
go back to the page. My code is as follows:


string strCRMUpdate = ini.ReadString("CRMCredentials", "CRMUpdate", "");
string strDefaultDB = ini.ReadString("CRMCredentials", "DefaultDB",
"Development");


this.ConnSQL.ConnectionString = "workstation id=M1;packet size=4096;user
id=sa;data source=MyServer;persist securi" +
"ty info=True;initial catalog=MyDB;password=mypass" +
"";


if (strDefaultDB == "Production")
{
this.ConnSQL.ConnectionString = strCRMUpdate;
}

then I get this error on the page:

An Error occured loading the document.

Could you switch on debugging and build the page in release build and enlist
the exact error you get?

Frans.
 
you could also try creating a temporary connection via the designer, which
will allow you to test the connection string against the data source (to
make sure that it is correct in the first place).

--

--

Br,
Mark Broadbent
mcdba , mcse+i
=============
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top