I have a web service that I am trying to get to connect to a SQL 2000 database. I have tried connecting with ODBCConnection and OleDbConnection and I am not able to open a connection with either one. The code I tried with both of these connection methods works fine in a .Net Windows Forms application. It seems to fail both times on the connection.Open() call for whatever reason.
Anyone know what might cause this and a solution I can do
Thanks,
Michael

Can't connect to database from web service!
clint 2
robnzrob
Here is some of the code I have now. I am unable to get the exact error right now because I can't debug on the machine I am on currently.
Any Ideas based on the code below
connection =
new OleDbConnection("Provider=SQLOLEDB;Data Source=10.10.200.121;Initial Catalog=SALES;UID=user;PWD=pw");try
{
connection->Open();
command = new OleDbCommand(query, connection);
reader = command->ExecuteReader();
reader->Read();
if(reader->HasRows)
{
this->recurrence = (DK_SCHEDULE_RECURRENCE )reader->GetInt32(0);
this->last_run_date = reader->GetDateTime(1);
this->next_run_date = reader->GetDateTime(2);
this->ftp_server = reader->GetString(3);
this->ftp_password = reader->GetString(4);
this->ftp_username = reader->GetString(5);
}
Zombie_002
Leander-Man
Sarosh79
Indigo Cowboy
do you have access to edit the code
try
{
connection->Open();
command = new OleDbCommand(query, connection);
reader = command->ExecuteReader();
reader->Read();
if(reader->HasRows)
{
this->recurrence = (DK_SCHEDULE_RECURRENCE )reader->GetInt32(0);
this->last_run_date = reader->GetDateTime(1);
this->next_run_date = reader->GetDateTime(2);
this->ftp_server = reader->GetString(3);
this->ftp_password = reader->GetString(4);
this->ftp_username = reader->GetString(5);
}
}
Catch OleDBException oleEX
{
Response->Write(oleEx.Message());
}
Catch Exception ex
{
Response->Write(ex.Message());
}
Finally
{
connection->Close();
}
Just trying to determine what errors are happening. Sorry if you already have this code written.