Advertisement
Advertisement
| 04.17.2008 at 07:29AM PDT, ID: 23330977 |
|
[x]
Attachment Details
|
||
|
[x]
The Solution Rating System
|
||
|
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: |
Here is the code:
// Open DB
CDataSource DataSource;
CString m_DSN = "C:\\Program Files\\NYLBIS\\Database\\db1.MDB";
CString m_connStr = "Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;Data Source=" + m_DSN + ";Mode=ReadWrite;Extended Properties=\"\";Jet OLEDB:System database=\"\";Jet OLEDB:Registry Path=\"\";Jet OLEDB:Database Password=\"\";Jet OLEDB:Engine Type=4;Jet OLEDB:Database Locking Mode=0;Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Global Bulk Transactions=1;Jet OLEDB:New Database Password=\"\";Jet OLEDB:Create System Database=False;Jet OLEDB:Encrypt Database=False;Jet OLEDB:Don't Copy Locale on Compact=False;Jet OLEDB:Compact Without Replica Repair=False;Jet OLEDB:SFP=False";
DataSource.OpenFromInitializationString(m_connStr.AllocSysString());
// Create session object
CSession Session;
Session.Open(DataSource);
CDBPropSet propset (DBPROPSET_ROWSET);
propset.AddProperty(DBPROP_IRowsetChange, true);
propset.AddProperty(DBACCESSOR_PARAMETERDATA, true);
propset.AddProperty(DBACCESSOR_ROWDATA, true);
propset.AddProperty(DBPROP_UPDATABILITY, DBPROPVAL_UP_CHANGE | DBPROPVAL_UP_INSERT | DBPROPVAL_UP_DELETE);
LPCSTR CommandText = "EXECUTE ZipcodeFilter ?";
hr = m_command_mult.Create(Session, CommandText, DBGUID_DEFAULT); // hr = S_OK
hr = m_command_mult.Prepare(); // hr = S_OK
// param vars
const int ParamCount = 1;
DBORDINAL dbOrd[ParamCount];
DBPARAMBINDINFO dbBind[ParamCount];
// set bind info
// zipcode
dbBind[0].bPrecision = 0;
dbBind[0].bScale = 0;
dbBind[0].dwFlags = DBPARAMFLAGS_ISINPUT;
dbBind[0].pwszName = L"parm";
dbBind[0].ulParamSize = 5;
dbBind[0].pwszDataSourceType = L"DBTYPE_WSTR";
dbOrd[0] = 1; // add parameter ordinal
//Set the parameters information.
hr = m_command_mult.SetParameterInfo(ParamCount, dbOrd, dbBind);
// hr returns DB_E_BADTYPENAME
// Bind the parameters with the accessor and command
void* pDummy;
hr = m_command_mult.BindParameters(&m_command_mult.m_hParameterAccessor, m_command_mult.m_spCommand,&pDummy);
// hr returns S_OK
wchar_t* nParamValue1 = L"33173";
flag = m_command_mult.SetParamString((ULONG)1, nParamValue1); // flag returns false
// Open the command.
hr = m_command_mult.Open(); // hr returns "DB_E_ERRORSINCOMMAND"
ZipcodeFilter QueryString =
SELECT Zipcode.*
FROM Zipcode
WHERE (((Zipcode.Zipcode)=[parm]));
|