作者 | 主题 |
---|---|
主题:OLE Error:0x80020005错误求解!
2010-11-15 12:51:44
楼主
执行完如下代码后:
#include "recipe.h" #define adUseClient 3 #define adOpenKeyset 1 #define adLockOptimistic 3 #define adCmdTable 2 #define adStateOpen 1 #define adStateClose 0 #pragma code ("kernel32.dll"); #pragma code (); extern __object *cnComasCS; __object *rsPlan=NULL; TCHAR ConnectionString1[_MAX_PATH + 1]; char strQuery[_MAX_PATH + 1]; char strParam[_MAX_PATH + 1]; char strValue[_MAX_PATH + 1]; char strPk[_MAX_PATH + 1]; char strBatch_ID[_MAX_PATH + 1]; char strBrand_ID[_MAX_PATH + 1]; char strBrand_Name[_MAX_PATH + 1]; char strDCCC_Source[_MAX_PATH + 1]; char strDCCC_Dest[_MAX_PATH + 1]; char strDCCC[_MAX_PATH + 1]; char strCASING[_MAX_PATH + 1]; char strCASING_Dest[_MAX_PATH + 1]; char strCASING_Source[_MAX_PATH + 1]; char strBURLEY[_MAX_PATH + 1]; char strBURLEY_Source[_MAX_PATH + 1]; char strBURLEY_Dest[_MAX_PATH + 1]; char strORIENTAL[_MAX_PATH + 1]; char strORIENTAL_Source[_MAX_PATH + 1]; char strORIENTAL_Dest[_MAX_PATH + 1]; char strDRYING[_MAX_PATH + 1]; char strDRYING_Source[_MAX_PATH + 1]; char strDRYING_Dest[_MAX_PATH + 1]; char strCounter[_MAX_PATH + 1]; char strCounter1[_MAX_PATH + 1]; char strWeight[_MAX_PATH + 1]; int ParamType,ParamID; long tempPk; int Counter; int Counter1; if(ComasCS_Open ()) //if (pk==0) { //printf("%s WriteReport(long pk %d , char *report %s) WriteReport. PK <=1 !\r\n",TimetoString(), pk, report); // return FALSE; //} if((rsPlan= __object_create("ADODB.RecordSet"))==NULL) { printf("WriteReport. Recordset not created.\r\n"); return ; } //printf("rs is ok\r\n"); for(Counter1=1;Counter1<=15;Counter1++) { //printf("1 is ok\r\n"); sprintf(strCounter1,"%d",Counter1); sprintf(strPk, "L_Plan_PK%s",strCounter1); SetTagDoubleWait(strPk,0); //Return-Type: BOOL //printf("1 is ok!\r\n"); sprintf(strBatch_ID, "L_Plan_Batch%s",strCounter1); SetTagDoubleWait(strBatch_ID,0); //Return-Type: BOOL // printf("2 is ok!\r\n"); sprintf(strBrand_ID, "L_Plan_BrandID%s",strCounter1); SetTagDWordWait(strBrand_ID,0); //Return-Type: BOOL //printf("3 is ok!\r\n"); sprintf(strBrand_Name, "L_Plan_BrandName%s",strCounter1); SetTagCharWait(strBrand_Name,"空"); //Return-Type: BOOL //printf("4 is ok!\r\n"); sprintf(strWeight, "L_Plan_Weight%s",strCounter1); SetTagDoubleWait(strWeight,0); //Return-Type: BOOL sprintf(strDCCC, "ST_L_DCCC%s",strCounter1); SetTagByteWait(strDCCC,0); //Return-Type: BOOL //printf("%d\r\n",rsPlan->Fields("ST_DCCC")); //printf("5 is ok!\r\n"); sprintf(strCASING, "ST_L_CASING%s",strCounter1); SetTagByteWait(strCASING,0); //Return-Type: BOOL sprintf(strBURLEY, "ST_L_BURLEY%s",strCounter1); SetTagByteWait(strBURLEY,0); //Return-Type: BOOL sprintf(strORIENTAL, "ST_L_ORIENTAL%s",strCounter1); SetTagByteWait(strORIENTAL,0); //Return-Type: BOOL sprintf(strDRYING, "ST_L_DRYING%s",strCounter1); SetTagByteWait(strDRYING,0); //Return-Type: BOOL //printf("%d\r\n",rsPlan->Fields("ST_DRYING")); //printf("6 is ok!\r\n"); sprintf(strDCCC_Source, "L_DCCC_Source%s",strCounter1); SetTagByteWait(strDCCC_Source,0); //Return-Type: BOOL //printf("7 is ok!\r\n"); sprintf(strDCCC_Dest, "L_DCCC_Dest%s",strCounter1); SetTagByteWait(strDCCC_Dest,0); //Return-Type: BOOL //printf("8 is ok!\r\n"); sprintf(strCASING_Source, "L_CASING_Source%s",strCounter1); SetTagByteWait(strCASING_Source,0); //Return-Type: BOOL //printf("7 is ok!\r\n"); sprintf(strCASING_Dest, "L_CASING_Dest%s",strCounter1); SetTagByteWait(strCASING_Dest,0); //Return-Type: BOOL sprintf(strBURLEY_Source, "L_BURLEY_Source%s",strCounter1); SetTagByteWait(strBURLEY_Source,0); //Return-Type: BOOL //printf("7 is ok!\r\n"); sprintf(strBURLEY_Dest, "L_BURLEY_Dest%s",strCounter1); SetTagByteWait(strBURLEY_Dest,0); //Return-Type: BOOL sprintf(strORIENTAL_Source, "L_ORIENTAL_Source%s",strCounter1); SetTagByteWait(strORIENTAL_Source,0); //Return-Type: BOOL //printf("7 is ok!\r\n"); sprintf(strORIENTAL_Dest, "L_ORIENTAL_Dest%s",strCounter1); SetTagByteWait(strORIENTAL_Dest,0); //Return-Type: BOOL sprintf(strDRYING_Source, "L_DRYING_Source%s",strCounter1); SetTagByteWait(strDRYING_Source,0); //Return-Type: BOOL //printf("9 is ok!\r\n"); sprintf(strDRYING_Dest, "L_DRYING_Dest%s",strCounter1); SetTagByteWait(strDRYING_Dest,0); //Return-Type: BOOL //printf("strCounter1 is %s!\r\n",strCounter1); } //printf("DATA is clear!\r\n"); sprintf(strQuery, "SELECT * FROM L_PLAN_LIST WHERE ST_DRYING < 30 ORDER BY PK ASC "); rsPlan->CursorLocation = adUseClient; //rsPlan->CommandTimeout=30; rsPlan->Open(strQuery, cnComasCS,adOpenKeyset ,adLockOptimistic); //printf("%d",rsPlan->RecordCount()); if (rsPlan->RecordCount() >0) { while(!rsPlan->eof) { rsPlan->MoveFirst; for(Counter=1;Counter<=rsPlan->RecordCount();Counter++) { sprintf(strCounter,"%d",Counter); sprintf(strPk, "L_Plan_PK%s",strCounter); SetTagDoubleWait(strPk,rsPlan->Fields("PK")); //Return-Type: BOOL //printf("pk is %d\r\n",rsPlan->Fields("PK")); sprintf(strBrand_ID, "L_Plan_BrandID%s",strCounter); SetTagByteWait(strBrand_ID,rsPlan->Fields("BRAND_ID")); //Return-Type: BOOL //printf("Brand_ID is %d\r\n",rsPlan->Fields("BRAND_ID")); sprintf(strBatch_ID, "L_Plan_Batch%s",strCounter); SetTagDoubleWait(strBatch_ID,rsPlan->Fields("BATCH_ID")); //Return-Type: BOOL //printf("Bathc_ID is %d\r\n",rsPlan->Fields("BATCH_ID")); sprintf(strBrand_Name, "L_Plan_BrandName%s",strCounter); SetTagCharWait(strBrand_Name,rsPlan->Fields("BRAND_NAME")); //Return-Type: BOOL //printf("BRAND_NAME is %d\r\n",rsPlan->Fields("BRAND_NAME")); sprintf(strWeight, "L_Plan_Weight%s",strCounter); SetTagDoubleWait(strWeight,rsPlan->Fields("WEIGHT")); //Return-Type: BOOL sprintf(strDCCC, "ST_L_DCCC%s",strCounter); SetTagByteWait(strDCCC,rsPlan->Fields("ST_DCCC")); //Return-Type: BOOL //printf("%d\r\n",rsPlan->Fields("ST_DCCC")); sprintf(strCASING, "ST_L_CASING%s",strCounter); SetTagByteWait(strCASING,rsPlan->Fields("ST_CASING")); //Return-Type: BOOL sprintf(strBURLEY, "ST_L_BURLEY%s",strCounter); SetTagByteWait(strBURLEY,rsPlan->Fields("ST_BURLEY")); //Return-Type: BOOL sprintf(strORIENTAL, "ST_L_ORIENTAL%s",strCounter); SetTagByteWait(strORIENTAL,rsPlan->Fields("ST_ORIENTAL")); //Return-Type: BOOL sprintf(strDRYING, "ST_L_DRYING%s",strCounter); SetTagByteWait(strDRYING,rsPlan->Fields("ST_DRYING")); //Return-Type: BOOL //printf("ST is ok!\r\n"); sprintf(strDCCC_Source, "L_DCCC_Source%s",strCounter); SetTagByteWait(strDCCC_Source,rsPlan->Fields("DCCC_SOURCE")); //Return-Type: BOOL //printf("DCCC_SOURCE is %d!\r\n",rsPlan->Fields("DCCC_SOURCE")); sprintf(strDCCC_Dest, "L_DCCC_Dest%s",strCounter); SetTagByteWait(strDCCC_Dest,rsPlan->Fields("DCCC_DEST")); //Return-Type: BOOL sprintf(strCASING_Source, "L_CASING_Source%s",strCounter); SetTagByteWait(strCASING_Source,rsPlan->Fields("CASING_SOURCE")); //Return-Type: BOOL //printf("DCCC_SOURCE is %d!\r\n",rsPlan->Fields("DCCC_SOURCE")); sprintf(strCASING_Dest, "L_CASING_Dest%s",strCounter); SetTagByteWait(strCASING_Dest,rsPlan->Fields("CASING_DEST")); //Return-Type: BOOL sprintf(strBURLEY_Source, "L_BURLEY_Source%s",strCounter); SetTagByteWait(strBURLEY_Source,rsPlan->Fields("BURLEY_SOURCE")); //Return-Type: BOOL //printf("DCCC_SOURCE is %d!\r\n",rsPlan->Fields("DCCC_SOURCE")); sprintf(strBURLEY_Dest, "L_BURLEY_Dest%s",strCounter); SetTagByteWait(strBURLEY_Dest,rsPlan->Fields("BURLEY_DEST")); //Return-Type: BOOL sprintf(strORIENTAL_Source, "L_ORIENTAL_Source%s",strCounter); SetTagByteWait(strORIENTAL_Source,rsPlan->Fields("ORIENTAL_SOURCE")); //Return-Type: BOOL //printf("DCCC_SOURCE is %d!\r\n",rsPlan->Fields("DCCC_SOURCE")); sprintf(strORIENTAL_Dest, "L_ORIENTAL_Dest%s",strCounter); SetTagByteWait(strORIENTAL_Dest,rsPlan->Fields("ORIENTAL_DEST")); //Return-Type: BOOL sprintf(strDRYING_Source, "L_DRYING_Source%s",strCounter); SetTagByteWait(strDRYING_Source,rsPlan->Fields("DRYING_SOURCE")); //Return-Type: BOOL sprintf(strDRYING_Dest, "L_DRYING_Dest%s",strCounter); SetTagByteWait(strDRYING_Dest,rsPlan->Fields("DRYING_DEST")); //Return-Type: BOOL rsPlan->MoveNext; } } //printf("Data is write!\r\n"); } rsPlan->close(); cnComasCS->Close; } 错误提示: OLE Error:0x80020005 请问是什么原因导致??
花落月下,月倚骄阳
|
|
主题:回复:OLE Error:0x80020005错误求解!
2010-11-15 15:35:22
1楼
在线求解,希望知道的大侠们告诉下
花落月下,月倚骄阳
|
|
主题:回复:OLE Error:0x80020005错误求解!
2010-11-15 18:02:20
2楼
这么长,你的问题在哪里??
www.lingkun.net
|
|
|