1、请问如何实现榆数据库的动态炼结?
2、请问如何查询一个表?
3、请问作数据库的开发是不是药用activex 的控件?
2、请问如何查询一个表?
3、请问作数据库的开发是不是药用activex 的控件?
解决方案 »
- 关于图片显示的问题
- 怎么用VC画球,不用OPENGL
- 怎么样通过代码删除word中activex控件?
- 求救视图打印的问题,急!!!!!!!!!!!!!!!!!1111
- 请教用VC代码和SQL语句分别实现写入SQL SERVER2000数据库中100000条记录的方法
- 为什么我用DAO连接Access2000会出现"Unrecognize database format……"这样的错误?而把Access转换为早期版本就没事呢?
- VC中的类型转换问题??
- 为什么ATL的工程要生成一个以工程名为名称的.c文件而不是.cpp文件?
- 软件加密高手请进;有钱赚!
- VC编译错误求助
- 请问_bstr_t是什么东西?和LPTSTR兼容吗?
- 使用video for windows 的几个问题
2.select * from tblname
3.不一定要用.
主要有以下類:CDatabase、CRecord
.Provider = "Microsoft.Jet.OLEDB.4.0"
.Properties("Data Source").value = App.Path & "\data.mdb"
.Properties("Persist Security Info").value = True
.Properties("Jet OLEDB:Database Password").value = "pass"
.CommandTimeout = 30
End With
'定义对象
Set DBRecordset = New ADODB.Recordset
With DBRecordset
'初始化一些属性
.CursorLocation = adUseClient
.LockType = adLockOptimistic
.CursorType = adOpenStatic
Set .ActiveConnection = cn
.Source = "select * from t_records where id=" & lRecordID
'打开数据集
.Open
If .EOF And .BOF Then
.AddNew
End If
.Fields!Title = LeftEx(Trim(txttitle.Text), 200)
.Fields!RecordType = lRecordType
.Fields!RType = Val(fraType.Tag)
'更新数据
.Update
'关闭数据集
.Close
End With
不过我想VC也差不多吧.
_CommandPtr pCmd = NULL;
_RecordsetPtr pRs = NULL;
HRESULT hResult = E_FAIL; _bstr_t bstrConn = _bstr_t(L"DSN=AccessDb;");
_bstr_t bstrSQL = _bstr_t(L"SELECT t_Folder.* FROM t_Folder"); // _ConnectionPtr
hResult = pConn.CreateInstance(__uuidof(Connection));
if (FAILED(hResult)) {
AfxMessageBox("pConn.CreateInstance");
return;
}
pConn->CursorLocation = adUseClient;
pConn->ConnectionString = bstrConn;
pConn->Open(_bstr_t(L""), _bstr_t(L""), _bstr_t(L""), -1); // _CommandPtr
hResult = pCmd.CreateInstance(__uuidof(Command));
if (FAILED(hResult)) {
AfxMessageBox("pCmd.CreateInstance");
return;
}
pCmd->ActiveConnection = pConn;
pCmd->CommandText = bstrSQL;
pCmd->CommandType = adCmdText; // _RecordsetPtr
hResult = pRs.CreateInstance(__uuidof(Recordset));
if (FAILED(hResult)) {
AfxMessageBox("pRs.CreateInstance");
return;
}
pRs->Open((_Command*)pCmd, vtMissing, adOpenForwardOnly, adLockOptimistic, adCmdText);
if (pRs->Supports(adAddNew) && pRs->Supports(adUpdate)) {
pRs->AddNew();
pRs->PutCollect(L"fName", L"fName");
pRs->PutCollect(L"fParent", _variant_t(11L));
pRs->Update();
}
你最上边的那句话市不是引用的delphi的tlb文件?
import 在vc中是什么意思?请执教