Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

C#ʵÏÖAccessµ¼Èëµ¼³öExcel

Ò»¡¢Access´ÓExcelÖе¼ÈëÊý¾Ý
1.Óõ½µÄExcel±íµÄ¸ñʽ¼°ÄÚÈÝ
 
ʵÏÖ
 OleDbConnection con = new OleDbConnection();
try
{
OpenFileDialog openFile = new OpenFileDialog();//´ò¿ªÎļþ¶Ô»°¿ò¡£
openFile.Filter = ("Excel Îļþ(*.xls)|*.xls");//ºó׺Ãû¡£
if (openFile.ShowDialog() == DialogResult.OK)
{
string filename = openFile.FileName;
int index = filename.LastIndexOf("\\");//½ØÈ¡ÎļþµÄÃû×Ö
filename = filename.Substring(index + 1);
conExcel.ConnectionString = "Provider=Microsoft.Jet.Oledb.4.0;Data Source=" +
Application.StartupPath + "\\Appdata.mdb";
//½«excelµ¼Èëaccess
//distinct :ɾ³ýexcelÖظ´µÄÐÐ.
//[excelÃû].[sheetÃû] ÒÑÓеÄexcelµÄ±íÒª¼Ó$
//where not in : ²åÈë²»Öظ´µÄ¼Ç¼¡£

string sql = "insert into Users2(Óû§±àºÅ,Óû§ÐÕÃû) select distinct * from [Excel 8.0;database=" +
filename + "].[name$] where Óû§±àºÅ not in (select Óû§±àºÅ from Users2) ";
OleDbCommand com = new OleDbCommand(sql, con);
con.Open();
com.ExecuteNonQuery();
MessageBox.Show("µ¼ÈëÊý¾Ý³É¹¦", "µ¼ÈëÊý¾Ý", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
finally
{
con.Close();
}
 
¶þ¡¢Accessµ¼³öExcel
OleDbConnection con = new OleDbConnection();
try
{
SaveFileDialog saveFile = new SaveFileDialog();
saveFile.Filter = ("Excel Îļþ(*.xls)|*.xls");//Ö¸¶¨Îļþºó׺ÃûΪExcel Î


Ïà¹ØÎĵµ£º

AccessµÄDBHelper.cs

using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.OleDb;
using System.Configuration;
namespace TaobaoDAL
{
public class DBHelper
{
//Òýµ¼Êý¾Ý¿âÁ¬½ÓÊý¾Ý¿âµ÷ÓÃWeb.ConfigÎļþ
private static OleDbConnection conn ......

asp.net(c#)´ÓCache¶ÔÏóɾ³ýÏѧϰÈռǶþ£©

ÉÏƪÎÄÕÂÖÐ˵µ½Ê²Ã´ÊÇ Cache¶ÔÏó£¬ÈçºÎÔÚASP.NETÖÐʹÓà Cache¶ÔÏó¡£ÏÂÃæÎÒÃÇÀ´ËµËµÈçºÎÔÚASP.NETÖÐɾ³ýÏî¡£
ASP.NET Cache ¶ÔÏóÉè¼ÆÓÃÓÚ±£Ö¤Ëü²¢²»Ê¹Óùý¶àµÄ·þÎñÆ÷ÄÚ´æ¡£½á¹ûÊÇ£¬µ±ÓÃÄÚ´æ±äµÃȱ·¦Ê±£¬Cache¶ÔÏó×Ô¶¯É¾³ý×îÉÙ±»Ê¹ÓõÄÏî¡£Äã¿ÉÒÔͨ¹ý¶¨Òåʱ¼äÏÞÖÆ¡¢ÒÀÀµÏî¡¢ÒÔ¼°Ïî
ÔÚCache¶ÔÏóÖеÄÓÅÏȼ¶À´Ó°Ïì Cache¶ÔÏó±£ ......

access sql server Êý¾Ý¿â Êý¾Ýµ¼³ö

×òÌìŪÁËÒ»¸ö±È½Ï¼¬ÊÖµÄÎÊÌâ¡£´ÓÍøÉÏÏÂÔØÁËÒ»¸öÈí¼þ£¬ËûµÄÊý¾Ý¿âÊÇaccessµÄ£¬´ò¿ª¿´ÁËһϣ¬¸Ð¾õ²»´í£¬ÊʺÏÎÒÏÖÔÚÏîÄ¿µÄÐèÇ󣬴󲿷ÖÄܹ»Âú×ãÎÒµÄÏîÄ¿ÐèÒª£¬¾ÍÏëÄÃÀ´Ö÷Òå¡£¿ÉÊÇÎÒÃÇÏîÄ¿µÄÊý¾Ý¿âÒ»Ö±¶¼ÊÇÓõÄsqlserver£¬ÓÚÊÇ£¬¾ÍÔÚÍøÉÏ·è¿ñµÄ£¬ÕÒ¹ØÓÚaccessת»»ÎªsqlserverµÄ×ÊÁÏÔÚÕâÀïÎÒÏë˵һÏÂÓйصÄ×¢ÒâÊÂÏ
Êý¾Ý¿âÉý ......

AccessÓëSqlServerÊý¾ÝÀàÐͱȽÏ,timestampʱ¼ä´ÁÏê½â

Ò»¡¢AccessÓëSqlServerÊý¾ÝÀàÐÍ±È½Ï Microsoft Access Êý¾ÝÀàÐÍ SQL Server Êý¾ÝÀàÐÍ ÊÇ/·ñ£¬£¨0ºÍ-1£©
1 룬²»ÔÊÐíÓÐ Null Öµ¡£ bit(1¡¢0 »ò NULL) Êý×Ö£¨×Ö½Ú£©£ ......

C#´ò°üSQLÊý¾Ý¿â²¿Êð°²×°


²Î¿¼¡¶ASP.NETÓëSQLÒ»Æð´ò°ü²¿Êð°²×°¡·
£¬ÕâƪÎÄÕÂÊÇÕë¶ÔVB.NETÓëSQL Ò»Æð´ò°üµÄ,µ«ÊÇÎÒʹÓõÄÊÇC#,µ±È»Ö»ÒªÐÞ¸ÄÒ»ÏÂÖ÷Òª°²×°Àà¿â¾ÍÐÐÁË!C#µÄÀà¿â´úÂëÈçÏÂ:DBCustomAction.cs
using System;
using System.Collections;
using System.Data.SqlClient;
using System.ComponentModel;
using System.Configuration.Inst ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ