عرض مشاركة واحدة
قديم 27 / 05 / 2001, 08 : 09 PM   #1
نشوان 
وئامي جديد

 


+ رقم العضوية » 335
+ تاريخ التسجيل » 22 / 05 / 2001

+ الجنسْ »

+ الإقآمـہ »

+ مَجموع المشَارگات » 3
+ معَدل التقييمْ » 10
شكراً: 0
تم شكره 0 مرة في 0 مشاركة

نشوان غير متواجد حالياً

1: IDBCreateCommand *pCreateCommand;
2: ICommandText *pCommandText;
3: ICommandWithParameters *pCommandWithParams;
4: DBPARAMBINDINFO ParamBindInfo[2];
5: ULONG ParamOrdinals[] = {1,2};
6: LPCSTR pwszCommandStr =
7: OLESTR("INSERT INTO Customers (CustNumber, CustLastName)
8: [ic:ccc] VALUES (?, ?)");
9:
10: // Use a Session object to create a CreateCommand interface
11: Session->CreateSession(NULL, IID_IDBCreateComand,
12: (IUnknown **) &pCreateCommand);
13:
14: // Create a CommandText interface
15: pCreateCommand->CreateCommand(NULL, IID_ICommandText,
16: (IUnknown **) &pCommandText);
17:
18: // Free the CreateCommand interface pointer
19: pCreateCommand->Release();
20:
21: // Specify the command, using the SetCommandText method
22: pCommandText->SetCommandText(DBGUID_DBSQL, pwszCommandStr);
23:
24: // Specify the command parameter information
25: ParamBindInfo[0].pwszDataSourceType = L"DBTYPE_II4";
26: ParamBindInfo[0].pwszName = L"CUST_ID";
27: ParamBindInfo[0].ulParamSize = sizeof(DWORD);
28: ParamBindInfo[0].dwFlags = DBPARAMFLAGS_ISINPUT;
29: ParamBindInfo[0].bPrecision = 0;
30: ParamBindInfo[0].bScale = 0;
31:
32: ParamBindInfo[1].pwszDataSourceType = L"DBTYPE_CHAR";
33: ParamBindInfo[1].pwszName = L"CUST_NAME";
34: ParamBindInfo[1].ulParamSize = 255;
35: ParamBindInfo[1].dwFlags = DBPARAMFLAGS_ISINPUT;
36: ParamBindInfo[1].bPrecision = 0;
37: ParamBindInfo[1].bScale = 0;
38:
39: pCommandText->QueryInterface(IID_ICommandWithParameters,
40: (void **) &pCommandWithParams);
41: pCommandWithParams->SetParameterInfo(2, ParamOrdinals, ParamBindInfo);
42:
43: // Release interfaces
44: pCommandText->Release();
45: pCommandWithParams->Release();

العلم نور

 

  رد مع اقتباس