//private string datapatch = ConfigurationSettings.AppSettings["acessconn"];//Êý¾Ý¿âµØÖ·
private string datapatch = "db/global.asa";//Êý¾Ý¿âµØÖ·
///
/// È¡µÃdataset
//
/// ²éѯÓï¾ä
///
public DataSet GetDataSet(string Commandtext)
{
string strConnection = "Provider=Microsoft.Jet.OLEDB.4.0; " +
"Data Source=" + Server.MapPath(datapatch);
string strCommandText = Commandtext;
OleDbConnection myConnection = new OleDbConnection(strConnection);
myConnection.Open();
OleDbDataAdapter myAdpater = new OleDbDataAdapter(strCommandText,myConnection);
OleDbCommandBuilder myBuilder = new OleDbCommandBuilder(myAdpater);
DataSet myDataset = new DataSet();
myAdpater.Fill(myDataset);
myConnection.Close();
return myDataset;
}
///
/// È¡µÃ±í
///
/// ²éѯÓï¾ä
///
public DataTable GetDataTable(string Com ......
//private string datapatch = ConfigurationSettings.AppSettings["acessconn"];//Êý¾Ý¿âµØÖ·
private string datapatch = "db/global.asa";//Êý¾Ý¿âµØÖ·
///
/// È¡µÃdataset
//
/// ²éѯÓï¾ä
///
public DataSet GetDataSet(string Commandtext)
{
string strConnection = "Provider=Microsoft.Jet.OLEDB.4.0; " +
"Data Source=" + Server.MapPath(datapatch);
string strCommandText = Commandtext;
OleDbConnection myConnection = new OleDbConnection(strConnection);
myConnection.Open();
OleDbDataAdapter myAdpater = new OleDbDataAdapter(strCommandText,myConnection);
OleDbCommandBuilder myBuilder = new OleDbCommandBuilder(myAdpater);
DataSet myDataset = new DataSet();
myAdpater.Fill(myDataset);
myConnection.Close();
return myDataset;
}
///
/// È¡µÃ±í
///
/// ²éѯÓï¾ä
///
public DataTable GetDataTable(string Com ......
·¢²¼ÈÕÆÚ : 8/8/2003 | ¸üÐÂÈÕÆÚ : 6/7/2004
Martin Tracy
Visual Studio Team
Microsoft Corporation
ÊÊÓÃÓÚ£º Microsoft® ADO.NET
Microsoft® ASP.NET
Microsoft® Visual C#® .NET
Microsoft® Visual Studio® .NET
ÕªÒª£º±¾ÑÝÁ·ËµÃ÷ÁËÈçºÎʹÓüòµ¥µÄ Visual C#® ÄÚº¬´úÂë Web Ó¦ÓóÌÐòͨ¹ý ADO.NET ÔÚ Microsoft® Access Êý¾Ý¿âÖÐÌí¼Ó¡¢É¾³ýºÍ±à¼¼Ç¼¡£
ÏÂÔØʾÀý´úÂë ADONETAccessDB.exe£¨Ó¢ÎÄ£©¡£(130KB)
±¾Ò³ÄÚÈÝ
¼ò½é
񻂗
ÑÝÁ·
²Î¿¼
¼ò½é
Jet Êý¾Ý¿âÒýÇæÓÉÓÃÓÚ Microsoft Access Êý¾Ý¿âµÄ Microsoft® Internet ÐÅÏ¢·þÎñ (IIS) Ìṩ¡£´ËÊý¾Ý¿âÒýÇæͨ³£¿ÉÒÔÌæ´ú Microsoft SQL Server£¬²¢ÇÒ¶ÔÓÚµÍÈÝÁ¿µÄ Web Ó¦ÓóÌÐò·Ç³£ÓÐÓá£Jet Êý¾Ý¿âÒýÇæÊÇ OLEDB ¼æÈݵģ¬Microsoft .NET Framework System.Data.OleDb ÃüÃû¿Õ¼äÖеÄÀàÖ§³Ö´ËÒýÇæ¡£
±¾ÑÝÁ·ÖÐÄú½«Ê¹ÓõÄÖ÷Òª¶ÔÏóΪ OleDbConnection¡¢OleDbCommand ºÍ OleDbDataReader ¶ÔÏó£¬ÒÔ¼° DataGrid ·þÎñÆ÷¿Ø¼þ¡£
ͼ 1 ADO.NET Êý¾Ý·ÃÎʹܵÀ
OleDbConnection ¶ÔÏó¿ØÖÆÓë Jet Êý¾Ý¿âÒýÇæµÄÁ¬½Ó¡£OleDbCommand °üº¬¸æÖªÊý¾Ý¿âÒýÇæ²ÉÈ¡ºÎÖÖ²Ù×÷µÄ Microsoft S ......
ÔÚweb configÖÐ ×÷ÈçÏÂÅäÖãº
<connectionStrings>
<add name="ydycon" connectionString="Provider=Microsoft.Jet.OLEDB.4.0;
Data Source=|DataDirectory|ydy.mdb" providerName="System.Data.OleDb"/>
</connectionStrings>
ÔÚ.netÎļþÖÐÓ¦ÓÃÁ´½Ó×Ö·û´®£º
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;
using System.Data.SqlClient; //Ìí¼ÓÒýÓÃ
using System.Text;
using System.IO;
using System.Collections;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
// string ConStr ......
ÔÚweb configÖÐ ×÷ÈçÏÂÅäÖãº
<connectionStrings>
<add name="ydycon" connectionString="Provider=Microsoft.Jet.OLEDB.4.0;
Data Source=|DataDirectory|ydy.mdb" providerName="System.Data.OleDb"/>
</connectionStrings>
ÔÚ.netÎļþÖÐÓ¦ÓÃÁ´½Ó×Ö·û´®£º
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;
using System.Data.SqlClient; //Ìí¼ÓÒýÓÃ
using System.Text;
using System.IO;
using System.Collections;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
// string ConStr ......
ÈÕÆÚ/ʱ¼ä
CDate ½«×Ö·û´®×ª»¯³ÉΪÈÕÆÚ select CDate("2005/4/5")
Date ·µ»Øµ±Ç°ÈÕÆÚ
DateAdd ½«Ö¸¶¨ÈÕÆÚ¼ÓÉÏij¸öÈÕÆÚselect dateAdd("d",30,Date())½«µ±Ç°ÈÕÆÚ¼ÓÉÏ30Ìì,ÆäÖÐd¿ÉÒÔ»»Îªyyyy»òHµÈ
DateDiff ÅжÏÁ½¸öÈÕÆÚÖ®¼äµÄ¼ä¸ô select DateDiff("d","2006-5-1","2006-6-1")·µ»Ø31,ÆäÖÐd¿ÉÒÔ»»Îªyyyy,m,HµÈ
DatePart ·µ»ØÈÕÆÚµÄij¸ö²¿·Ö select DatePart("d","2006-5-1")·µ»Ø1,¼´1ºÅ£¬dÒ²¿ÉÒÔ»»Îªyyyy»òm
Day ·µ»ØÈÕÆÚµÄd²¿·Ö,µÈͬÓÚdatepartµÄd²¿·Ö
Hour ·µ»ØÈÕÆÚµÄСʱ
IsDate ÅжÏÊÇ·ñÊÇÈÕÆÚ,ÊÇÈÕÆÚ·µ»Ø-1,²»ÊÇÈÕÆÚ·µ»Ø0
Minute ·µ»ØÈÕÆڵķÖÖÓ²¿·Ö
Month ·µ»ØÈÕÆÚµÄÔ·ݲ¿·Ö
Now ·µ»Øµ±Ç°Ê±¼ä(ÍêÕûʱ¼ä£¬°üÀ¨ÄêÔÂÈÕ Ð¡Ê±·ÖÃë)
Second ·µ»ØÈÕÆÚµÄÃ벿·Ö
Time ·µ»Øµ±Ç°µÄʱ¼ä²¿·Ö(¼´³ýÈ¥Äê/ÔÂ/ÈյIJ¿·Ö)
Weekday ·µ»Øij¸öÈÕÆڵĵ±Ç°ÐÇÆÚ(ÐÇÆÚÌìΪ1,ÐÇÆÚһΪ2,ÐÇÆÚ¶þΪ3...)£¬ÀýÈçselect weekday(now());
Year ·µ»Øij¸öÈÕÆÚµÄÄê·Ý
¡ø¼ì²é
IsEmpty ¼ì²âÊÇ·ñΪ¿Õ(²»¹ý¾²âÊÔ£¬²»¹ÜʲôÇé¿ö£¬¶ ......
Èí¼þÃû³Æ: EA2A(Excel/Access to Access)
Èí¼þ°æ±¾: beta2
ÊÚȨÐÎʽ: Ãâ·ÑÈí¼þ
ÔËÐÐƽ̨: Win9x/Me/NT/2000/XP/2003
Êý¾Ý¿âÉý¼¶ºóÔÓбíÖÐ×ֶλáÔö¼Ó£¬´ËʱÎÒÃǾÍÐèÒªµ¼È루ǨÒÆ£©Êý¾Ý£¬´Ë³ÌÐòΪʵÏִ˹¦Äܶø±àд¡£
ͨ³£Èí¼þÉý¼¶ºó£¬Êý¾Ý¿âÒ²»áÓÐËù¸Ä±ä£¬´Ëʱ¾ÍÐèÒª¶Ô¿Í»§Ê¹ÓõÄÊý¾Ý¿â½øÐÐÉý¼¶¡£Éý¼¶¿Í»§Êý¾Ý¿âµÄ·½Ê½ÓУº
1.Ð޸ĵ±Ç°Êý¾Ý±íµÄ×ֶΣ¬±ÈÈçÌí¼ÓÁУ¬ÓÖ·ÖΪ¿ÉÊÓ»¯´´½¨ºÍʹÓÃSQL½Å±¾¶þÖÖ·½Ê½¡£
2.´´½¨ÁÙʱ±í→ɾ³ýÔʼ±í→´´½¨Ð±í→×îºóÔÙ½«ÁÙʱ±íÊý¾Ý²åÈëµ½ÐÂ±í¡£
ÕâЩ²Ù×÷ÊDz»ÊDZȽϷ±Ëö£¬Ê¹ÓÃEA2AÔò¿ÉÒÔ½ÚÊ¡ºÜ¶à²»±ØÀ˷ѵÄʱ¼ä£¬²»±Øµ±ÐÄÿ´Î³ÌÐòÉý¼¶ºóÊý¾Ý¿â²úÉúµÄÏàÓ¦±ä»¯¡£
EA2A¿ÉÒÔ×÷ΪÊý¾ÝÉϱ¨Ê±µÄµ¼È빤¾ß£¬±ÈÈçϼ¶»ú¹Ø¶ÔÉϼ¶»ú¹ØÉϱ¨Êý¾Ý£¨¿ÉÉϱ¨Excel/Access¸ñʽ£©¡£
EA2AÖ§³ÖAccessÊý¾Ý¿â±íÓë±í¡¢ÊÓͼÓëÊÓͼ֮¼äÊý¾ÝµÄ»¥µ¼¡£
EA2A¿É×öΪ¼òµ¥µÄSQL²éѯ·ÖÎöÆ÷ʹÓã¬Èç¹û´ò¿ª·½Ê½ÎªExcel£¬½öÖ§³Ö²éѯÓï¾ä£¬±ÈÈçselect * from [user$] where id=2£¬Èç¹û´ò¿ª·½Ê½ÎªAccessÔòÖ§³Ö¼¸ºõËùÓеÄSQLÓï¾ä£¬±ÈÈçinsert/update/delete/Create/DropµÈµÈ¡£
SQL ½Å±¾Ö´ÐÐ
Êý¾Ýµ¼Èë
Ôö¼Ó»ò¸üÐÂGUID×Ö¶Î
Èç¹ûÄúÓÐʲôºÃµÄÒâ¼þºÍ½¨ÒéÇë¸øÎÒ·¢E-m ......
1£¬´ò¿ª”¿ØÖÆÃæ°å“Ï”¹ÜÀí¹¤¾ß“ÖеĔÊý¾Ý¿âÔ´“£»
2£¬°´”Ìí¼Ó“Ìí¼ÓÒ»¸öеÄÊý¾ÝÔ´£¬ÔÚÑ¡ÔñÀ¸ÀïÑ¡“Driver do microsoft Access (*.mdb)”£¬Íê³Éºó½«³öÏÖÒ»¸ö¿ò£¬ÔÚ“Êý¾Ý¿âÔ´”ÀïÃæÊäÈëÄãÏëдµÄÃû³Æ£¬ÎÒÈ¡Ãû½Ð“ABC”£¬ËµÃ÷²»ÐèÒªÌ½Ó×Å£¬°´ÏÂÃæµÄÑ¡Ôñ£¬Ñ°ÕÒÄãµÄÊý¾Ý¿âµØÖ·ºÍÑ¡ÖУ¨×¢Ò⣬ÇëÏȱ¸·Ý×Ô¼ºµÄACCESSÊý¾Ý¿â£©£¬È»ºóÈ·¶¨¡£Êý¾ÝÔ´ÔÚÕâÀィºÃÁË£¬Ê£ÏÂת»»ÁË¡£
3£¬´ò¿ªSQL2000ÆóÒµ¹ÜÀíÆ÷£¬½øÈëÊý¾Ý¿â£¬Ð½¨Ò»¸ö¿ÕµÄÊý¾Ý¿â“ABC”£»
4£¬Ñ¡Ôñн¨Á¢µÄÊý¾Ý¿â£¬°´Êó±êÓÒ¼ü£¬Ñ¡Ôñ“ËùÓÐÈÎÎñ”Ï“µ¼ÈëÊý¾Ý”£¬°´“ÏÂÒ»²½”¼ÌÐø£»
5£¬ÔÚÊý¾Ý¿âÔ´ÏÂÀµ«ÖÐÑ¡Ôñ”Driver do microsoft Access(*.mdb)“£¬ÔÚ”Óû§/ϵͳDSN“ÖУ¬Ñ¡ÖÖÄã¸Õ²ÅÌí¼ÓµÄ”ABC“£¬°´ ”ÏÂÒ»²½“£»
6£¬“Ä¿µÄ”²»ÐèÒªÐ޸ģ¬Ñ¡Ôñ·þÎñÆ÷£¨Ò»°ãÏÂΪ×Ô¼ºµÄ±¾»úlocal£¬Ò²¿ÉÒÔÑ¡Ôñ·þÎñÆ÷µØÖ·»òÕß¾ÖÓòÍøµØÖ·£¬È·¶¨ÄãµÄȨÏÞÊÇ·ñ¿ÉÒÔ²Ù×÷£¬)£¬Ê¹ÓÃWINDOWS Éí·ÝÑéÖ¤Ö¸ÓÃ×Ô¼ºµÄϵͳ¹ÜÀíÔ±Éí·Ý²Ù×÷£¬Ê¹ÓÃSQLÉí·Ý²Ù×÷ÑéÖ¤¿ÉÒÔÓÃÓÚ ......