473,401 Members | 2,139 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,401 software developers and data experts.

How do I change connection strings with csharp??

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.
Nov 16 '05 #1
2 1648
acool wrote:
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.
--
Get LLBLGen Pro, the new O/R mapper for .NET: http://www.llblgen.com
My .NET Blog: http://weblogs.asp.net/fbouma
Microsoft C# MVP
Nov 16 '05 #2
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
=============
"Frans Bouma [C# MVP]" <pe******************@xs4all.nl> wrote in message
news:xn***************@msnews.microsoft.com...
acool wrote:
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.
--
Get LLBLGen Pro, the new O/R mapper for .NET: http://www.llblgen.com
My .NET Blog: http://weblogs.asp.net/fbouma
Microsoft C# MVP

Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Brad Britton | last post by:
Just wondering how you would break a string such as first and last name together, into two separate strings or variables, each containing the firstName and lastName. I am a newbie at C# so any help...
1
by: Marsha | last post by:
Does anyone know how to add a new data provider to Visual Studio - to the Provider list in Server Explorer. I am using Sybase's ADO.NET Data Provider. It has been added to my GAC and appears in...
1
by: andrewcw | last post by:
I get an "Could not find installable ISAM." But the error does not make sense. to me. I converted this code to C# that I found on the internet: ( ...
1
by: Tajmiester | last post by:
Hi, And thanks for any help. I am having trouble declaring a struct containing strings that can be Serialized using the following functions. It works, but the strings wont store the right number...
3
by: bob | last post by:
Hi, I am trying to encrypt my connection string in the app.config file. I am using Base64 encryption, I just want to hide it from casual users. I keep getting file not found error. However...
2
by: hfk0 | last post by:
Hi, I have a simple asp.net application running ok on my WinXP development server with SQL Server Express 2005 installed locally. After moving to the live server (Win 2000 server with MSDE 2000...
37
by: sam44 | last post by:
Hi, At startup the user log on and chooses the name of a client from a dropdownlist, which then changes dynamically the connection string (the name of the client indicates which database to use)....
2
by: VB Programmer | last post by:
Using ASP.NET 2.0 Created DataSet1.xsd. It's using the Connection "ASPNETDBConnectionString (Web.config)". I want to use a different one, LocalSqlServer. How do I change it? I tried to...
2
by: Johnson | last post by:
I'm trying to fix a "sub optimal" situation with respect to connection string management. Your thoughtful responses will be appreciated. I just started with a new client who has a bunch of legacy...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.