Hallo, habe folgendes:
An der Stelle wo nun Fehler steht springt er in die catch funktion und meldet folgendes : Code=800abb9 Msg: UNknown error 0x800a0bb9 Source:ADODB.Recordset Description: Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.
Leider bin ich absoluter Neuling bei C++ und weiß nicht an was es liegen könnte.
Beim Debuggen hat die Fehlerzeile fogende Werte:
rsString="Select datum,identnummer,etext FROM protokoll WHERE identnummer='14090984' order by datum desc"(1)
&pCon=0x00f70e98
adOpenForwardOnly=0
adLockReadOnly=1
adCmdUnknown=8
HILFE!
Code:
void CAdoTestDlg::OnGetProductType()
{
// TODO: Add your control notification handler code here
char *ProductType;
char *SeriaNumber;
try
{
_ConnectionPtr pCon = NULL;
_RecordsetPtr pRs = NULL;
FieldPtr pfldFirstName, pfldLastName, pfldAge;
_variant_t vFirstName, vLastName, vAge;
_bstr_t bsEmpty = L"";
// Create and set pCon structure
pCon.CreateInstance(__uuidof(Connection));
pCon->Provider = "SQLOLEDB";
pCon->CommandTimeout = 3;
// Define and set connection string
_bstr_t cnnString = "DATA SOURCE='ABG0796A';USER ID='alles_lesen';PASSWORD='lesen';";
// INITIAL CATALOG='Asys';PROMPT='adPromptNever';";
// pCon->Open(cnnString, "alles_lesen", "lesen", adConnectUnspecified);
// pCon->Open(bsEmpty, "alles_lesen", "lesen", adConnectUnspecified);
pCon->ConnectionString = cnnString;
pCon->CursorLocation = adUseClient;
pCon->ConnectionTimeout = 1;
pCon->Open(bsEmpty, bsEmpty, bsEmpty, adConnectUnspecified);
long test1=0;
test1 = pCon->State; //test1=1 O.K.
// Create and set pRs structure
pRs.CreateInstance(__uuidof(Recordset));
pRs->PutRefActiveConnection( pCon );
// Open the record set and retrieve the data
_bstr_t rsString = "SELECT datum,identnummer,etext FROM protokoll WHERE "
"identnummer = '14090984' order by datum desc";
pRs->Open(rsString, &pCon, adOpenForwardOnly, adLockReadOnly, adCmdUnknown); //FEHLER?
int rstFound = pRs->RecordCount;
if (rstFound > 0)
{
//pRs->Close();
}
// Close connections
pRs->Close();
pCon->Close();
}
catch( _com_error &e )
{
_bstr_t bstrSource(e.Source());
_bstr_t bstrDescription(e.Description());
CString str;
str.Format("\tCode = %08lx", e.Error());
str += " Msg: "; str += e.ErrorMessage();
str += " Source: "; str += bstrSource;
str += " Description: "; str += bstrDescription;
AfxMessageBox(str);
}
Leider bin ich absoluter Neuling bei C++ und weiß nicht an was es liegen könnte.
Beim Debuggen hat die Fehlerzeile fogende Werte:
rsString="Select datum,identnummer,etext FROM protokoll WHERE identnummer='14090984' order by datum desc"(1)
&pCon=0x00f70e98
adOpenForwardOnly=0
adLockReadOnly=1
adCmdUnknown=8
HILFE!
