ADO数据库连接Access
创建基于对话框的应用程序ADO,向对话框中添加一个列表视图控件,并为其添加变量m_Grid
第一步:ADO对象的导入
在StdAfx.h头文件中:
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, bu
// are changed infrequently
//
#if !defined(AFX_STDAFX_H__D5ADC0DF_B5B2_4973_A035_4F2F1585998F__INCLUDED_)
#define AFX_STDAFX_H__D5ADC0DF_B5B2_4973_A035_4F2F1585998F__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
#include <afxwin.h> // MFC core and standard components
#include <afxext.h> // MFC extensions
#include <afxdisp.h> // MFC Automation classes
#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include <afxcmn.h> // MFC support for Windows Common Controls
#endif // _AFX_NO_AFXCMN_SUPPORT
//ADO对象的导入代码
#import"C:\Program Files\Common Files\System\ado\msado15.dll"
no_namespace rename("EOF","adoEOF")rename("BOF","adoBOF")
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_STDAFX_H__D5ADC0DF_B5B2_4973_A035_4F2F1585998F__INCLUDED_)
第二步:初始化COM环境
BOOL CADOApp::InitInstance()
{
AfxEnableControlContainer();
AfxOleInit();//或者::CoInitialize(NULL);
··················
··················
return FALSE;
}
第三步:连接数据库
相关文档:
'创建数据库
Private Sub Create(ByVal mdbPath As String)
If File.Exists(mdbPath) Then
Throw New Exception("目标数据库已经存在,无法创建")
......
问题:
有二个表
A表:
id Comment yuyan lanmuid
1 aaaa chinese 1
2 bbbb english 1
3 cccc chinese 2
4 ddddd english 2
B表:
id lanmu
1 公司简介
2 联系方式
3 经营范围
在删除B表的一行数据时会把A表关联ID的数据也删除,请问有什么好方法?我不想操作2次删除的语句.
解决方 ......
Double action
fingerprint
and access code security door lock for your home,
office or small business. Get modern biometric security at your entry point with
this standard door handle style double action doorlock.
This is the most secure and convenient method in assuring only authorized peo ......
网上搜集,备用
下表列出了 ANSI SQL 数据类型和等效的 Microsoft Jet 数据库引擎 SQL数据类型还有它们的有效同义字以及 等效的 Microsoft SQL Server数据类型。
ANSI SQL
数据类型
Microsoft Access
SQL 数据类型
同义词
Microsoft SQL
Server 数据类型
BIT、BIT VARYING
BINARY(参见注释)
VARBINARY、 ......
string sql = "select a.orderId,a.UserName,b.CodeValue as Delivery ,a.DeliveryAddress,a.PhoneNum,c.CodeValue as Payment,d.CodeValue as OrderStatus,d.CodeValue as OrderStatusID,a.OrderTime,a.Merchant from (( m_Order a ";
sql += " left j ......