怎样在VC6.0控制台上写SQL语句 怎样在VC6.0控制台上写SQL语句,请高手举个例子,我在自学数据库 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 #import "c:\program files\common files\system\ado\msado15.dll" no_namespace rename("EOF","adoEOF") int main(int argc, char* argv[]) { printf("This sample shows you how to access BLOB via ADO and store it as file" "The second field of the database is BLOB\n" "If it works, it is writen by masterz,\n" "otherwise I don't know who write it\n"); CoInitialize(NULL); try { _ConnectionPtr pConn("ADODB.Connection"); _RecordsetPtr pRst("ADODB.Recordset"); _variant_t varBLOB; pConn->Open(_bstr_t("Driver={Microsoft Access Driver (*.mdb)};DBQ=GetChunk.mdb"),"","",adConnectUnspecified); pRst->Open(_bstr_t("BlobTable"),_variant_t((IDispatch *) pConn, true), adOpenKeyset, adLockOptimistic, adCmdTable); pRst->MoveFirst(); //long lDataLength = pRst->Fields->Item[1L]->ActualSize; //varBLOB = pRst->Fields->Item[1L]->GetChunk(lDataLength); _StreamPtr stream; stream.CreateInstance("ADODB.Stream"); _variant_t varOptional(DISP_E_PARAMNOTFOUND,VT_ERROR); stream->raw_Open(varOptional, adModeUnknown, adOpenStreamUnspecified,NULL,NULL); stream->put_Type(adTypeBinary); stream->Write(pRst->GetFields()->GetItem(_variant_t((long)1))->GetValue()); stream->SaveToFile("test.txt",adSaveCreateOverWrite); printf("save stream to file finished\n"); stream->Close(); pRst->Close(); pConn->Close(); } catch (_com_error &e) { printf("Description = '%s'\n", (char*) e.Description()); } ::CoUninitialize(); return 0; } 数据库中删除用户 sql语句编写 复制数据文件,急! 高手救命, 关于数据库的导出 做数据复制时,agent是不是必须得启动 无法打开登录所请求的数据库"db_test";登录失败 金额型数据如何方便地显示出来 插入两个字数为2000个的text的存储过程问题 帮我写一条新建表的语句,很简单。 access怎麽降序查询呀 计件工资标准查询问题 select top N时怎么指定按某个字段进行排序??
int main(int argc, char* argv[])
{
printf("This sample shows you how to access BLOB via ADO and store it as file"
"The second field of the database is BLOB\n"
"If it works, it is writen by masterz,\n"
"otherwise I don't know who write it\n");
CoInitialize(NULL);
try
{
_ConnectionPtr pConn("ADODB.Connection");
_RecordsetPtr pRst("ADODB.Recordset");
_variant_t varBLOB;
pConn->Open(_bstr_t("Driver={Microsoft Access Driver (*.mdb)};DBQ=GetChunk.mdb"),"","",adConnectUnspecified);
pRst->Open(_bstr_t("BlobTable"),_variant_t((IDispatch *) pConn, true),
adOpenKeyset, adLockOptimistic, adCmdTable);
pRst->MoveFirst();
//long lDataLength = pRst->Fields->Item[1L]->ActualSize;
//varBLOB = pRst->Fields->Item[1L]->GetChunk(lDataLength);
_StreamPtr stream;
stream.CreateInstance("ADODB.Stream");
_variant_t varOptional(DISP_E_PARAMNOTFOUND,VT_ERROR);
stream->raw_Open(varOptional, adModeUnknown, adOpenStreamUnspecified,NULL,NULL);
stream->put_Type(adTypeBinary);
stream->Write(pRst->GetFields()->GetItem(_variant_t((long)1))->GetValue());
stream->SaveToFile("test.txt",adSaveCreateOverWrite);
printf("save stream to file finished\n");
stream->Close();
pRst->Close();
pConn->Close();
}
catch (_com_error &e)
{
printf("Description = '%s'\n", (char*) e.Description());
}
::CoUninitialize();
return 0;
}