TO:jiangsheng(蒋晟)大瞎怎么样设主键?
解决方案 »
- 本人在清华同方做4年开发,高级程序员;现在外包微软做软件开发测试工程师,对开发和测试都比较熟悉了,目前月薪7k,大家看以后找什么工
- 请问怎么样在VC中调用C#编写的DLL呀?
- 问个极为菜鸟的问题
- 重(分)求图形报表,只要简要介绍就行,本人想对图形报表作份分析
- 怎么样用VC调用 regsvr32.exe 命令
- windows mobile MFC
- 如何在程序退出时不弹出是否保存对话框?
- 如何解决同时包含#include <iostream.h>与#include <vector> using namepace std;之间的冲突?
- WinInet类编程请教……
- 【求助】绘图被其他窗口覆盖后消失
- 如何用VC调用EXCEL,WORD对象?
- 谁有8*8点阵的汉字库,请给我一份,谢谢![[email protected]]
CDaoDatabase db;
db.Open(_T("c:\\db1.mdb"));
// Create a table called MySeekTable with a GUID primary key field named
// ID and a field named Found.
db.Execute(_T("create table MySeekTable (ID guid constraint PKEY primary
key, Found text)"));
// Insert a few records using an insert into statement.
db.Execute(_T("insert into MySeekTable (ID, Found) values ({guid
{11111111-aabb-aabb-aabb-aabbccddeeff}},'Guid1')"));
db.Execute(_T("insert into MySeekTable (ID, Found) values ({guid
{22222222-aabb-aabb-aabb-aabbccddeeff}},'Guid2')"));
db.Execute(_T("insert into MySeekTable (ID, Found) values ({guid
{33333333-aabb-aabb-aabb-aabbccddeeff}},'Guid3')"));
// Open table-type recordset (must use table-type for Seek) and select
// index for seek.
CDaoRecordset rs(&db);
rs.Open(dbOpenTable,_T("MySeekTable"));
rs.SetCurrentIndex(_T("PKEY"));
// Construct the GUID you want to find and seek the GUID.
COleVariant varGUIDValue(_T("{guid {22222222-aabb-aabb-aabb-
aabbccddeeff}}"), VT_BSTRT);
if (rs.Seek(_T("="),&varGUIDValue)) {
// GUID found. Retrieve and display value.
CString strResult = V_BSTRT(&rs.GetFieldValue(_T("Found")));
AfxMessageBox("Seek of guid found '" + strResult + "'");
} else {
// GUID not found.
AfxMessageBox("Seek of guid failed.");
}