jjones7947
October 5th, 2009, 08:01 AM
Have two Sybase access methods:
They are declared in the header file as:
public:
ArrayList^ getWork();
void insertType(WorkRow^ row);
Implemented in the cpp file as:
ArrayList^ SybaseAccess::getWork()
{
rwl->AcquireReaderLock(15000);
ArrayList^ files = gcnew ArrayList();
setConnection();
try
{
conn = gcnew AseConnection(connString);
AseCommand^ command = gcnew AseCommand(GetWork, conn);
command->CommandType = CommandType::Text;
Logger.addToLog("Command " + command.CommandText);
conn->Open();
AseDataReader^ reader = command->ExecuteReader();
while(reader->Read())
{
WorkRow^ tmp = gcnew WorkRow();
tmp->setDoc_id(reader->GetInt64(1));
tmp->setDoc_path(reader->GetString(2));
files->Add(tmp);
}
}
catch(AseException^ e)
{
Logger::writeToErrorFile("Exception Thrown in getWork " + e->StackTrace);
}
rwl->ReleaseReaderLock();
return(files);
}
void SybaseAccess::insertType(WorkRow^ row)
{
rwl->AcquireReaderLock(15000);
setConnection();
AseParameter^ param = nullptr;
try
{
conn = gcnew AseConnection(connString);
AseCommand^ command = gcnew AseCommand(SetType, conn);
command->CommandType = CommandType::Text;
param = gcnew AseParameter();
param->ParameterName = "@fileId";
param->AseDbType = AseDbType::BigInt;
param->Direction = ParameterDirection::Input;
param->Value = row->getDoc_id();
command->Parameters->Add(param);
conn->Open();
}
catch(AseException^ e)
{
}
rwl->ReleaseReaderLock();
}
In the first function on the line creating the connection:
conn = gcnew AseConnection(connString);
I get 4 errors all of the type error C2686: cannot overload static and non-static member functions with the same parameter types.
On the second use of the function (in the second class function) I get no errors!!!
What is the difference and how am I using this library function differently?
Jim
They are declared in the header file as:
public:
ArrayList^ getWork();
void insertType(WorkRow^ row);
Implemented in the cpp file as:
ArrayList^ SybaseAccess::getWork()
{
rwl->AcquireReaderLock(15000);
ArrayList^ files = gcnew ArrayList();
setConnection();
try
{
conn = gcnew AseConnection(connString);
AseCommand^ command = gcnew AseCommand(GetWork, conn);
command->CommandType = CommandType::Text;
Logger.addToLog("Command " + command.CommandText);
conn->Open();
AseDataReader^ reader = command->ExecuteReader();
while(reader->Read())
{
WorkRow^ tmp = gcnew WorkRow();
tmp->setDoc_id(reader->GetInt64(1));
tmp->setDoc_path(reader->GetString(2));
files->Add(tmp);
}
}
catch(AseException^ e)
{
Logger::writeToErrorFile("Exception Thrown in getWork " + e->StackTrace);
}
rwl->ReleaseReaderLock();
return(files);
}
void SybaseAccess::insertType(WorkRow^ row)
{
rwl->AcquireReaderLock(15000);
setConnection();
AseParameter^ param = nullptr;
try
{
conn = gcnew AseConnection(connString);
AseCommand^ command = gcnew AseCommand(SetType, conn);
command->CommandType = CommandType::Text;
param = gcnew AseParameter();
param->ParameterName = "@fileId";
param->AseDbType = AseDbType::BigInt;
param->Direction = ParameterDirection::Input;
param->Value = row->getDoc_id();
command->Parameters->Add(param);
conn->Open();
}
catch(AseException^ e)
{
}
rwl->ReleaseReaderLock();
}
In the first function on the line creating the connection:
conn = gcnew AseConnection(connString);
I get 4 errors all of the type error C2686: cannot overload static and non-static member functions with the same parameter types.
On the second use of the function (in the second class function) I get no errors!!!
What is the difference and how am I using this library function differently?
Jim