Click to See Complete Forum and Search --> : What does this error mean and what is different


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

Alex F
October 5th, 2009, 08:28 AM
What happens in AseConnection class? Can you post AseConnection header file?
Sometimes C++ compiler doesn't show duplicated errors, maybe second error is not reported because of this.

jjones7947
October 6th, 2009, 07:24 AM
AseConnection is a class within the .NET Data Provider Sybase.Data.AseClient.dll. As such I've never seen header files for any of the classes in this dll. As you know using it involves adding a reference to it to the project and some kind of "using" statement in the files where it is used. It has worked fine in C# project I've done. Following is a list of AseConnection's public members copied from the Object Browser. (Would have put them in but the forum thinks they are images)

Thanks,
Jim