VC/MFCÖеÄACCESSÊý¾Ý¿â·ÃÎÊʵÏÖ(·½·¨3)
½Ó 2
·½·¨3 :
ÕâÖÖ·½·¨Ò²ÐèÒªÓû§×Ô¼º´´½¨Ò»¸öÊý¾ÝÔ´£¬µ«ÊÇ£¬ËùÐèÒª½øÐеIJ½Ö裬±È·½·¨2ÒªÉÙÉÏÐí¶à¡£
´´½¨ºÃÓû§±í¡£
´´½¨Êý¾ÝÔ´£¨¿ØÖÆÃæ°å->Êý¾Ý¹ÜÀí->Êý¾ÝÔ´ Ë«»÷ -> Ñ¡Ôñ Îļþ DSN -> Ìí¼Ó -> Microsoft Access Driver -> ÊÖ¶¯ÊäÈëDSN ±£´æµÄλÖü°Ãû³Æ -> Ñ¡Ôñ(S) ²¢Ñ¡ÖÐËù´´½¨ºÃµÄÊý¾Ý¿âÎļþ -> È·¶¨ -> È·¶¨ ... Íê³É £©
´´½¨Ò»¸ö»ùÓÚMFC¶Ô»°¿òµÄ¹¤³Ì¡£ÆäËû¹¤³ÌÒ²¿É¡£
ÔÚÖ÷´°¿ÚµÄº¯ÊýÍ·²¿¼ÓÈë #include <afxdb.h>
ΪÖ÷³ÌÐò¶¨Òåһȫ¾Ö±äÁ¿ CDatabase cdb1 ;
ÔÚ³ö´°¿ÚµÄ³õʼ»¯³ö¼ÓÈëÈçÏ´úÂ룺
cdb1.open("Äǻᴴ½¨µÄÊý¾ÝÔ´Ãû³Æ");
ΪÖ÷´°¿ÚÌí¼ÓÒ»¸ö°´Å¥£¬²¢Ìí¼Ó°´Å¥µÄÏàÓ¦º¯Êý¡£
ÔÚÏìÓ¦º¯ÊýÖеĴ¦Àí´úÂëÈçÏ£º
CString strTmp = "Insert into mydb(SUserName, SSex) values ('ÀîËÄ','ÄÐ')";
cdb1.ExecuteSQL(strTmp);
ÕâÑùµÄ»°£¬µÚÈýÖÖ·½·¨Ò²½áÊøÁË¡£
PS£º
¶ÔÓÚCDatabase Àà £¬Èç¹ûÏëÏêϸÁ˽âµÄ»°£¬¿ÉÒÔµ½ÍøÉÏÈ¥ËÑË÷Ï¡£
¶ÔÓÚÀàÀïÃæµÄOpen£¨£©·½·¨£¬ÕâÀïÓÐÒ»¸öÁ¬½ÓÊǶÔËû½øÐн²½âµÄ
http://www.sunxin.org/article/1042.html
Ïà¹ØÎĵµ£º
'´´½¨Êý¾Ý¿â
Private Sub Create(ByVal mdbPath As String)
If File.Exists(mdbPath) Then
Throw New Exception("Ä¿±êÊý¾Ý¿âÒѾ´æÔÚ£¬ÎÞ·¨´´½¨")
......
ÍøÉÏËѼ¯£¬±¸ÓÃ
ϱíÁгöÁË ANSI SQL Êý¾ÝÀàÐͺ͵ÈЧµÄ Microsoft Jet Êý¾Ý¿âÒýÇæ SQLÊý¾ÝÀàÐÍ»¹ÓÐËüÃǵÄÓÐЧͬÒå×ÖÒÔ¼° µÈЧµÄ Microsoft SQL ServerÊý¾ÝÀàÐÍ¡£
ANSI SQL
Êý¾ÝÀàÐÍ
Microsoft Access
SQL Êý¾ÝÀàÐÍ
ͬÒå´Ê
Microsoft SQL
Server Êý¾ÝÀàÐÍ
BIT¡¢BIT VARYING
BINARY£¨²Î¼û×¢ÊÍ£©
VARBINARY¡¢ ......
private const string ACCESS_UPDATE_ADMIN_PASSWORD = "UPDATE [Admins] SET admin_pass=@adminPass WHERE admin_name=@adminName";
dbInstance.SetParameters("@adminPass", _adminDObj.Admin_Password);
dbInstance.SetParameters("@adminName", _adminDObj.Admin_Name);
²ÎÊýµÄ˳Ðò±ØÐëºÍSQLµÄ˳ÐòÒ»Ö±£¬·ñÔòÎÞ·¨¸ ......
Á¬½ÓACCESSÊý¾Ý¿âµÄ¼òµ¥JSP´úÂ룺
<%@ page language="java" contentType="text/html; charset=GB18030"
pageEncoding="GB18030"%>
<%@ page import="java.sql.*" %>
<%
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver") ;
String url="jdbc:odbc:Driver={MicroSoft Access Drive ......
×î³£¼ûµÄÊý¾ÝÀàÐÍÓ³ÉäµÄÁбí
ϱíÁгöÁËÔÚ Microsoft Access ºÍÈçºÎÕâЩÊý¾ÝÀàÐÍÓëÏà¹Ø Microsoft.net ¿ò¼ÜÊý¾ÝÀàÐÍ£¬²¢ OleDbType ö¾ÙÖÐʹÓÃ×î³£¼ûµÄÊý¾ÝÀàÐÍ¡£
ÊÕÆð¸Ã±í¸ñÕ¹¿ª¸Ã±í¸ñ
·ÃÎÊÀàÐÍÃû³Æ
Êý¾Ý¿âÊý¾ÝÀàÐÍ
OLE DB ÀàÐÍ
.NET ¿ò¼ÜÀàÐÍ
³ÉÔ±Ãû³Æ
Îı¾
VarWChar
DBTYPE_WSTR
System.String
OleDbType.V ......