J
Jennifer
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;connect
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
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;connect
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