using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.OleDb;
/// <summary>
/// DataAccess µÄժҪ˵Ã÷
/// </summary>
public class DataAccess
{
protected static OleDbConnection conn = new OleDbConnection();
protected static OleDbCommand comm = new OleDbCommand();
public DataAccess()
{
//init
}
private static void openConnection()
{
if (conn.State == ConnectionState.Closed)
{
conn.ConnectionString = @"Provider=Microsoft.J ......
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.OleDb;
/// <summary>
/// DataAccess µÄժҪ˵Ã÷
/// </summary>
public class DataAccess
{
protected static OleDbConnection conn = new OleDbConnection();
protected static OleDbCommand comm = new OleDbCommand();
public DataAccess()
{
//init
}
private static void openConnection()
{
if (conn.State == ConnectionState.Closed)
{
conn.ConnectionString = @"Provider=Microsoft.J ......
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.OleDb;
/// <summary>
/// DataAccess µÄժҪ˵Ã÷
/// </summary>
public class DataAccess
{
protected static OleDbConnection conn = new OleDbConnection();
protected static OleDbCommand comm = new OleDbCommand();
public DataAccess()
{
//init
}
private static void openConnection()
{
if (conn.State == ConnectionState.Closed)
{
conn.ConnectionString = @"Provider=Microsoft.J ......
ÕâһƪÎÒÔÙ˵˵ˮ¾§±¨±íµÄÇé¿ö¡£ACCESSÖжÔӦˮ¾§±¨±í·½Ã棬´ó¼Ò¿ÉÄÜ»áÓöµ½µÄ×î¶àµÄÎÊÌâÓ¦¸Ã¾ÍÊÇ´ò¿ª±¨±íºó
»á³öÏÖÐèÒªµÇ¼µÄÎÊÌâ¡£
Õâ¸öÊÇΪʲôÄØ£¿Ã÷Ã÷ÎÒûÓÐÉèÖÃÃÜÂ룬Ôõô»áÓÐÒªÊäÈëÃÜÂëÄØ£¿Èç¹ûÄã¹»³Á×Å£¬Èç¹ûÄãµÄdebug¾Ñ鲻ȱ·¦µÄ»°£¬
Äã»á·¢ÏÖÔÚË®¾§±¨±íÌø³öÊäÈëÃÜÂëµÄµÇ¼¿òÖУ¬accessµÄ·¾¶²»ÊÇÎÒÏÖÔÚÊý¾Ý¿â·ÅÖõÄλÖã¬ÈÔÈ»ÊÇÎÒÔÚ±àÂëµÄʱºò
Ñ¡ÔñµÄÊý¾Ý¿âµØÖ·¡£ËûΪʲôûÓбäÄØ£¿ÆäʵÕâ¸öʱºòÄãÐèÒªÎÊ£¬Õâ¸öµØַΪʲôҪ±ä£¿
µ±ÄãʹÓù«Ó÷þÎñÆ÷µÄʱºò£¬¿ÉÄܲ»»á³öÏÖÕâ¸öÎÊÌ⣬ÒòΪÄã²»¹Üµ½Äĸö¿Í»§¶ËʹÓ㬷þÎñÆ÷µØÖ·²»»á±ä¡£È»¶øÄãÓÃaccess£¬
µ±Êý¾Ý¿â¸ú×Å»»Á˵çÄԺ󣬷þÎñÆ÷µØÖ·µ±È»Ò²±äÁË£¬¶øÄã±àÂëÖеĵØַȴûÓб䣬Õâ¸ö¾ÍÊÇÎÊÌâ³öÏÖµÄÔÒò¿©£¡Ã÷°×ÁË°É£¿
ÆäʵÊǺܼòµ¥µÄÒ»¸öµÀÀí¡£
ÄÇÔõô°ìÄØ£¿ÀϹæ¾Ø£¬¿´´úÂë¡£
‘Êý¾Ý¿âÁ¬½Ó
DBConnection.ConnectionString = DB_CnStr()
DBConnection.Open()
'¿ªÊ¼²éѯ
Dim sql As New System.Text.StringBuilder
Dim DT As New DataTable
sql.Append(" SELECT * from WORDINFO")
Dim cmd As New OleDb.OleDbCommand(sql.ToStri ......
ÕâһƪÎÒÔÙ˵˵ˮ¾§±¨±íµÄÇé¿ö¡£ACCESSÖжÔӦˮ¾§±¨±í·½Ã棬´ó¼Ò¿ÉÄÜ»áÓöµ½µÄ×î¶àµÄÎÊÌâÓ¦¸Ã¾ÍÊÇ´ò¿ª±¨±íºó
»á³öÏÖÐèÒªµÇ¼µÄÎÊÌâ¡£
Õâ¸öÊÇΪʲôÄØ£¿Ã÷Ã÷ÎÒûÓÐÉèÖÃÃÜÂ룬Ôõô»áÓÐÒªÊäÈëÃÜÂëÄØ£¿Èç¹ûÄã¹»³Á×Å£¬Èç¹ûÄãµÄdebug¾Ñ鲻ȱ·¦µÄ»°£¬
Äã»á·¢ÏÖÔÚË®¾§±¨±íÌø³öÊäÈëÃÜÂëµÄµÇ¼¿òÖУ¬accessµÄ·¾¶²»ÊÇÎÒÏÖÔÚÊý¾Ý¿â·ÅÖõÄλÖã¬ÈÔÈ»ÊÇÎÒÔÚ±àÂëµÄʱºò
Ñ¡ÔñµÄÊý¾Ý¿âµØÖ·¡£ËûΪʲôûÓбäÄØ£¿ÆäʵÕâ¸öʱºòÄãÐèÒªÎÊ£¬Õâ¸öµØַΪʲôҪ±ä£¿
µ±ÄãʹÓù«Ó÷þÎñÆ÷µÄʱºò£¬¿ÉÄܲ»»á³öÏÖÕâ¸öÎÊÌ⣬ÒòΪÄã²»¹Üµ½Äĸö¿Í»§¶ËʹÓ㬷þÎñÆ÷µØÖ·²»»á±ä¡£È»¶øÄãÓÃaccess£¬
µ±Êý¾Ý¿â¸ú×Å»»Á˵çÄԺ󣬷þÎñÆ÷µØÖ·µ±È»Ò²±äÁË£¬¶øÄã±àÂëÖеĵØַȴûÓб䣬Õâ¸ö¾ÍÊÇÎÊÌâ³öÏÖµÄÔÒò¿©£¡Ã÷°×ÁË°É£¿
ÆäʵÊǺܼòµ¥µÄÒ»¸öµÀÀí¡£
ÄÇÔõô°ìÄØ£¿ÀϹæ¾Ø£¬¿´´úÂë¡£
‘Êý¾Ý¿âÁ¬½Ó
DBConnection.ConnectionString = DB_CnStr()
DBConnection.Open()
'¿ªÊ¼²éѯ
Dim sql As New System.Text.StringBuilder
Dim DT As New DataTable
sql.Append(" SELECT * from WORDINFO")
Dim cmd As New OleDb.OleDbCommand(sql.ToStri ......
×Ô¶¨ÒåÊý¾Ý¿âÁ´½ÓÀà(Access)ÊÇÁ´½ÓAccessÊý¾Ý¿âʱʹÓõÄÀà¡£
²¹×㣺Application.StartupPath.ToStringÊÇÖ¸¶¨Éú³É.EXEÎļþµÄ·¾¶£¬°ÑÊý¾Ý¿âºÍÖ´ÐÐÎļþ´æ·Åµ½Ò»Æðʱ£¬²»¹Ü°²×°ºóÔÚʲô·¾¶¶¼ÎÞÐèÌض¨Ö¸¶¨¡£
Imports System.Data.OleDb
#Region "È«¾Ö±äÁ¿"
Private mTimeout As Integer
Private mDbConn As OleDbConnection
Private mSqlConn As OleDbCommand 'SQLÖ´ÐÐ
Private sTblNm As String '´æ·ÅÊý¾ÝµÄ±íÃû
Private mbOpen As Boolean 'DBÁ´½ÓÅжÏÓÃ
Private mDbReader As ......
×Ô¶¨ÒåÊý¾Ý¿âÁ´½ÓÀà(Access)ÊÇÁ´½ÓAccessÊý¾Ý¿âʱʹÓõÄÀà¡£
²¹×㣺Application.StartupPath.ToStringÊÇÖ¸¶¨Éú³É.EXEÎļþµÄ·¾¶£¬°ÑÊý¾Ý¿âºÍÖ´ÐÐÎļþ´æ·Åµ½Ò»Æðʱ£¬²»¹Ü°²×°ºóÔÚʲô·¾¶¶¼ÎÞÐèÌض¨Ö¸¶¨¡£
Imports System.Data.OleDb
#Region "È«¾Ö±äÁ¿"
Private mTimeout As Integer
Private mDbConn As OleDbConnection
Private mSqlConn As OleDbCommand 'SQLÖ´ÐÐ
Private sTblNm As String '´æ·ÅÊý¾ÝµÄ±íÃû
Private mbOpen As Boolean 'DBÁ´½ÓÅжÏÓÃ
Private mDbReader As ......
Access µÄ SQL ÖУ¬¼ÆËãÏàÓ¦±àºÅµÄ¼Ç¼֮¼ä ¼Ó ¼õ µÄ²éѯÃüÁî
ÀýÈç ¼ÆËãIDΪ 6 µÄ ºÏ¼Æ ¼õÈ¥ ID Ϊ 2¡¢3¡¢4 ÒÔ¼°¼ÓÉÏ ID Ϊ 5 µÄºÏ¼Æ
SELECT SUM(R) AS ½á¹û
from
(
SELECT ºÏ¼Æ AS R from T1 WHERE (ID = 6) UNION
SELECT -ºÏ¼Æ AS R from T1 WHERE (ID = 2) UNION
SELECT -ºÏ¼Æ AS R from T1 WHERE (ID = 3) UNION
SELECT -ºÏ¼Æ AS R from T1 WHERE (ID = 4) UNION
SELECT ºÏ¼Æ AS R from T1 WHERE (ID = 5)
) T ......
Access µÄ SQL ÖУ¬¼ÆËãÏàÓ¦±àºÅµÄ¼Ç¼֮¼ä ¼Ó ¼õ µÄ²éѯÃüÁî
ÀýÈç ¼ÆËãIDΪ 6 µÄ ºÏ¼Æ ¼õÈ¥ ID Ϊ 2¡¢3¡¢4 ÒÔ¼°¼ÓÉÏ ID Ϊ 5 µÄºÏ¼Æ
SELECT SUM(R) AS ½á¹û
from
(
SELECT ºÏ¼Æ AS R from T1 WHERE (ID = 6) UNION
SELECT -ºÏ¼Æ AS R from T1 WHERE (ID = 2) UNION
SELECT -ºÏ¼Æ AS R from T1 WHERE (ID = 3) UNION
SELECT -ºÏ¼Æ AS R from T1 WHERE (ID = 4) UNION
SELECT ºÏ¼Æ AS R from T1 WHERE (ID = 5)
) T ......
C# accessÈÕÆÚ²éѯ¼Ó#
if (((string)((ComboBoxItem)cmbField.SelectedItem).Value).Equals("System.DateTime"))
{
//ÅжÏÈÕÆÚµÄ;
if (checkBox1.Checked == true)
{
value = "#" + cmbValue.SelectedItem.ToString().Trim() + "#";
}
} ......
C# accessÈÕÆÚ²éѯ¼Ó#
if (((string)((ComboBoxItem)cmbField.SelectedItem).Value).Equals("System.DateTime"))
{
//ÅжÏÈÕÆÚµÄ;
if (checkBox1.Checked == true)
{
value = "#" + cmbValue.SelectedItem.ToString().Trim() + "#";
}
} ......
½üÆÚÓиöСCMSÏîÄ¿£¬ÓÉÓÚ·þÎñÆ÷¡¢ÈËÔ±ÒÔ¼°¹ÜÀíÖƶȵÈһϵÁÐÎÊÌ⣬²»µÃ²»²ÉÓÃJava Web+AccessÕâÖÖ²»Âײ»ÀàµÄ×éºÏ½øÐпª·¢£¬ÆÚ¼äÓöµ½ÁËÒ»¸öСÎÊÌ⣬ÄǾÍÊÇÎÄÕÂÄÚÈݲÉÓÃAccessµÄ“±¸×¢”ÀàÐÍ´æȡʱ£¬·¢Éú×Ô¶¯½Ø¶ÏµÄÎÊÌâ¡£Ò²¾ÍÊÇ˵£¬´æ½øÈ¥10000×ÖµÄÎÄÕ£¬Ö»ÄÜÏÔʾ³ö3000×Ö¡£¾¹ý²éÕÒ×ÊÁϺÍʵÑ飬·¢ÏÖÕâ¸öÎÊÌâÊÇPreparedStatementµÄsetter()ºÍgetter()·½·¨Ê¹Óò»µ±Ôì³ÉµÄ¡£
¹Ù·½×ÊÁÏÏÔʾ£¬AccessµÄ“±¸×¢”×ֶεÄ×Ö·û¸öÊý£¬Èôͨ¹ýÓû§½çÃæÊäÈëÔò×î´óΪ65,535£»ÈôÒÔ±à³Ì·½Ê½ÊäÈëʱÔò¿ÉÖ§³Ö1G×Ö½ÚµÄ×Ö·û´æ´¢¡£ËùÒÔ²»´æÔÚÊý¾Ý¿â×Ö¶ÎÀàÐÍÑ¡Ôñ´íÎóµÄÎÊÌâ¡£ÄÇôֻÓÐÔÚ´æÈ¡µÄ¹ý³ÌÖÐÕÒÎÊÌâÁË¡£
JavaµÄStringÀàÐÍÍüÁ˾¿¾¹ÄÜ´æ·Å¶àÉÙ¸ö×Ö·ûÁË£¨10µÄ16´Î·½£¿£©£¬×ÜÖ®Ò²²»ÊÇStringÀàÐ͵ĴíÎó¡£Òò´Ë£¬¾Í½«ÎÊÌⶨλÔÚÁË´¦ÀíÊý¾Ý¿â´æ·ÅµÄsetter()ºÍgetter()·½·¨ÉÏÁË¡£¾²é£¬setString()·½·¨ÄÜ´æµÄֵȡ¾öÓڸòÎÊýÏà¶ÔÓÚÇý¶¯³ÌÐòÔÚ VARCHAR
ÖµÉϵÄÏÞÖƵĴóС¡£GoogleÁËһϣ¬ÍøÉÏÌṩÁ˸÷ÖÖ·½·¨£¬ÊÔÁËÊÔclobµÄ·½Ê½£¬·¢ÏÖAccessËƺõ²»Ö ......
½üÆÚÓиöСCMSÏîÄ¿£¬ÓÉÓÚ·þÎñÆ÷¡¢ÈËÔ±ÒÔ¼°¹ÜÀíÖƶȵÈһϵÁÐÎÊÌ⣬²»µÃ²»²ÉÓÃJava Web+AccessÕâÖÖ²»Âײ»ÀàµÄ×éºÏ½øÐпª·¢£¬ÆÚ¼äÓöµ½ÁËÒ»¸öСÎÊÌ⣬ÄǾÍÊÇÎÄÕÂÄÚÈݲÉÓÃAccessµÄ“±¸×¢”ÀàÐÍ´æȡʱ£¬·¢Éú×Ô¶¯½Ø¶ÏµÄÎÊÌâ¡£Ò²¾ÍÊÇ˵£¬´æ½øÈ¥10000×ÖµÄÎÄÕ£¬Ö»ÄÜÏÔʾ³ö3000×Ö¡£¾¹ý²éÕÒ×ÊÁϺÍʵÑ飬·¢ÏÖÕâ¸öÎÊÌâÊÇPreparedStatementµÄsetter()ºÍgetter()·½·¨Ê¹Óò»µ±Ôì³ÉµÄ¡£
¹Ù·½×ÊÁÏÏÔʾ£¬AccessµÄ“±¸×¢”×ֶεÄ×Ö·û¸öÊý£¬Èôͨ¹ýÓû§½çÃæÊäÈëÔò×î´óΪ65,535£»ÈôÒÔ±à³Ì·½Ê½ÊäÈëʱÔò¿ÉÖ§³Ö1G×Ö½ÚµÄ×Ö·û´æ´¢¡£ËùÒÔ²»´æÔÚÊý¾Ý¿â×Ö¶ÎÀàÐÍÑ¡Ôñ´íÎóµÄÎÊÌâ¡£ÄÇôֻÓÐÔÚ´æÈ¡µÄ¹ý³ÌÖÐÕÒÎÊÌâÁË¡£
JavaµÄStringÀàÐÍÍüÁ˾¿¾¹ÄÜ´æ·Å¶àÉÙ¸ö×Ö·ûÁË£¨10µÄ16´Î·½£¿£©£¬×ÜÖ®Ò²²»ÊÇStringÀàÐ͵ĴíÎó¡£Òò´Ë£¬¾Í½«ÎÊÌⶨλÔÚÁË´¦ÀíÊý¾Ý¿â´æ·ÅµÄsetter()ºÍgetter()·½·¨ÉÏÁË¡£¾²é£¬setString()·½·¨ÄÜ´æµÄֵȡ¾öÓڸòÎÊýÏà¶ÔÓÚÇý¶¯³ÌÐòÔÚ VARCHAR
ÖµÉϵÄÏÞÖƵĴóС¡£GoogleÁËһϣ¬ÍøÉÏÌṩÁ˸÷ÖÖ·½·¨£¬ÊÔÁËÊÔclobµÄ·½Ê½£¬·¢ÏÖAccessËƺõ²»Ö ......