473,386 Members | 1,803 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,386 software developers and data experts.

Connection String Problem

I've inherited a C# program that inserts some records from a text file
into a table. Everything worked fine until I was asked to change the
server and database that the tables are on. Now I am having
connection issues.

This is the code:

public DB()
{
string ConStr;
ConStr = @"Data source=HQJPSQLBI\HQJPSQLBI;initial
catalog=ods_production;trusted_connection=Yes;conn ect
timeout=30";

conn = new SqlConnection(ConStr);
conn.Open();

//conn = new SqlConnection("user id=xxx;password=xxx;initial
catalog=wbmain;data source=localhost;Connect Timeout=30");
}

It fails on exiting. The error is

"An unhandled exception of type 'System.Data.SqlClient.SqlException'
occurred in system.data.dll

Additional information: System error."

However, the code that is commented out works works without error.
The only thing I changed was the connection string, which leads me to
believe there is something wrong with it. Would someone take a look?
I am really a VB person and don't know squat about C#.

Thanks,
Jennifer
Nov 16 '05 #1
1 2300
Change the Trusted_Connection to Integrated Security=SSPI. Check this out
http://www.connectionstrings.com

--
W.G. Ryan MVP (Windows Embedded)

TiBA Solutions
www.tibasolutions.com | www.devbuzz.com | www.knowdotnet.com
"Jennifer" <je**********@hotmail.com> wrote in message
news:33**************************@posting.google.c om...
I've inherited a C# program that inserts some records from a text file
into a table. Everything worked fine until I was asked to change the
server and database that the tables are on. Now I am having
connection issues.

This is the code:

public DB()
{
string ConStr;
ConStr = @"Data source=HQJPSQLBI\HQJPSQLBI;initial
catalog=ods_production;trusted_connection=Yes;conn ect
timeout=30";

conn = new SqlConnection(ConStr);
conn.Open();

//conn = new SqlConnection("user id=xxx;password=xxx;initial
catalog=wbmain;data source=localhost;Connect Timeout=30");
}

It fails on exiting. The error is

"An unhandled exception of type 'System.Data.SqlClient.SqlException'
occurred in system.data.dll

Additional information: System error."

However, the code that is commented out works works without error.
The only thing I changed was the connection string, which leads me to
believe there is something wrong with it. Would someone take a look?
I am really a VB person and don't know squat about C#.

Thanks,
Jennifer

Nov 16 '05 #2

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

Similar topics

6
by: Paul Robinson | last post by:
I am developing a website in ASP that connects to a Sybase database. However, when I try to open a connection to the database the page will not load. The script does not timeout, nor the...
17
by: AMC | last post by:
Hi, I'm using an include file to store the connection string to a database. Whenever I try to reference that string to open a connection in the page that includes the file I get the error 'empy...
0
by: Bob | last post by:
I have an ASP.NET web application that has been running without any problems for a while. I recently transferred the site to shared hosting and had multiple users start to use the site. The problem...
4
by: Rahul Anand | last post by:
Getting SQL Exception when trying to implement Connection based Trasaction using SQL Helper class. I am using the follwing function to execute my stored procs: -=-=-=- ExecuteScalar(ByVal...
6
by: Bala Nagarajan | last post by:
Hello, I am using Oracle 9i in my application and facing a problem with the connection string. In the datasource attribute of the connection string i had to specify an entry in "tnsnames.ora"...
14
by: WebMatrix | last post by:
Hello, I have developed a web application that connects to 2 different database servers. The connection strings with db username + password are stored in web.config file. After a code review,...
2
by: RyoSaeba | last post by:
Hello, I have a problem with the session state set to Sql Server (AspNet 1.1, Windows Server 2003 on an Application Center cluster, Sql Server 2000 on another server). Sometimes, when many user...
20
by: fniles | last post by:
I am using VS2003 and connecting to MS Access database. When using a connection pooling (every time I open the OLEDBCONNECTION I use the exact matching connection string), 1. how can I know how...
3
by: Harry Strybos | last post by:
Hi All I have a really strange problem occurring in my application. When I read in the application settings for connection strings the following happens: Here are my connection string settings...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.