°ÑaccessÊý¾Ý¿âµ¼Èëexcel±í¸ñ
public void ExportExcel(DataTable dtData, string filename)
{
System.Web.UI.WebControls.DataGrid dgExport = null;
// µ±Ç°¶Ô»°
System.Web.HttpContext curContext = System.Web.HttpContext.Current;
// IOÓÃÓÚµ¼³ö²¢·µ»ØexcelÎļþ
System.IO.StringWriter strWriter = null;
System.Web.UI.HtmlTextWriter htmlWriter = null;
if (dtData != null)
{
// ÉèÖñàÂëºÍ¸½¼þ¸ñʽ
curContext.Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(filename) + ".xls");//¼ÓHttpUtility.UrlEncode()·½·¨´¦ÀíÎļþÃûÂÒÂë
curContext.Response.Charset = "gb2312";
curContext.Response.ContentEncoding = System.Text.Encoding.GetEncoding("gb2312");
//HttpContext.Current.Response.ContentType=".xls/.txt/.doc";image/JPEG;text/HTML;image/GIF;vnd.ms-excel/msword
curContext.Response.ContentType = ".xls";
// µ¼³öexcelÎļþ
strWriter = new System.IO.StringWriter();
htmlWriter = new System.Web.UI.HtmlTextWriter(strWriter);
// ΪÁ˽â¾
Ïà¹ØÎĵµ£º
PBÖÐÁ¬½ÓAccessÊý¾Ý¿âµÄÈýÖÖ·½·¨
·½Ê½Ò»£º
SQLCA.DBMS = "ODBC"
SQLCA.AutoCommit = False
SQLCA.DBParm = "ConnectString='driver=Microsoft Access Driver (*.mdb);DBQ=c:\foodmart.mdb'"
CONNECT;
IF SQLCA.SQLCode <> 0 THEN
MessageBo ......
ÔÚweb configÖÐ ×÷ÈçÏÂÅäÖãº
<connectionStrings>
<add name="ydycon" connectionString="Provider=Microsoft.Jet.OLEDB.4.0;
Data Source=|DataDirectory|ydy.mdb" providerName="System.Data.OleDb"/>
</connectionStrings>
ÔÚ.netÎļþÖÐÓ¦ÓÃÁ´½Ó ......
ÈÕÆÚ/ʱ¼ä
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& ......
1£¬´ò¿ª”¿ØÖÆÃæ°å“Ï”¹ÜÀí¹¤¾ß“ÖеĔÊý¾Ý¿âÔ´“£»
2£¬°´”Ìí¼Ó“Ìí¼ÓÒ»¸öеÄÊý¾ÝÔ´£¬ÔÚÑ¡ÔñÀ¸ÀïÑ¡“Driver do microsoft Access (*.mdb)”£¬Íê³Éºó½«³öÏÖÒ»¸ö¿ò£¬ÔÚ“Êý¾Ý¿âÔ´”ÀïÃæÊäÈëÄãÏëдµÄÃû³Æ£¬ÎÒÈ¡Ãû½Ð“ABC”£¬ËµÃ÷²»ÐèÒªÌ½Ó×Å ......
2008-04-10 09:45 //*******FactoryManage.cs using System;
using System.Reflection;
using System.Configuration;
using CoalTraffic.IDAL; namespace CoalTraffic.DALFactory
{
/// <summary>
/// ³éÏ󹤳§Ä£Ê½´´½¨DAL¡£
......