coinitialize(null);
_connectionptr pmyconnect=null;
hresult hr=pmyconnect.createinstance(__uuidof(connection));
if(failed(hr))return;
_bstr_t strconnect="provider=sqloledb; server=7bwz82x-xp-cn//sqlexpress;"
"database=wx; uid=sa; pwd=123456;";
//connecting to the database server now:
trycatch (_com_error &e)
_commandptr pcmd = null;
_recordsetptr precordset = null;
pcmd.createinstance(__uuidof(command));
precordset.createinstance(_uuidof(recordset));
pcmd->activeconnection = pmyconnect;
pcmd->commandtype = adcmdstoredproc;
pcmd->commandtext=_bstr_t(_t("adduser")); //sp name
pcmd->parameters->refresh();
char chid[65];
sprintf(chid,"%ld", time(0));
pcmd->parameters->getitem((long)1)->value = _variant_t(chid);
pcmd->parameters->getitem((long)2)->value = _variant_t("chid");
//pcmd->parameters->item[_variant_t(_bstr_t("@loginname") )]->value=_variant_t(chid);
//pcmd->parameters->item[_variant_t(_bstr_t("@password") )]->value=_variant_t("dd");
/*precordset = */pcmd->execute(null,null,adcmdstoredproc);
//precordset.release();
_variant_t v= pcmd->parameters->getitem((long)0)->value;
cstring str;
str.format(_t("%d"), v.intval);
messagebox(str);
pcmd.release();
pmyconnect.release();
couninitialize();
VC2010的 DYNAMICBASE鏈結選項問題
近期偶然用windbg給乙個控制台程式的入口函式下斷點,位址之際用編譯出的map檔案中main函式的位址。結果windbg報告斷點未下成功,經過反覆檢視,包括在vc環境中除錯執行,均發現main函式的位址和map檔案中位址不一樣,切帶有隨機性。又用vc6.0實驗一遍,發現沒有任何問題。看來問題是出在...
VC 2010讀取BIN檔案
最近在弄stm32更新韌體的上位機,記錄一下碰到的問題點 unsigned long nfilebytes 用於儲存bin檔案總位元組數 unsigned char abinbyte 65536 用於儲存從bin檔案獲取的資料 file pfile wfopen s pfile,strfilepat...
VC2010編譯過程中出現鏈結失敗
在編譯c 過程中出現的提示錯誤 linkissue error link fatal error lnk1123 failure during conversion to coff file invalid or cor。參考了網上的幾種解決方案 1 第一種為 增量編譯錯誤,在編譯過程中不進行增量編...