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 Î
Ïà¹ØÎĵµ£º
<?xml version="1.0" encoding="utf-8"?>
<LinkLibrary xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Link Cat="aa" Url="aa" Desc="aa" />
<Link Cat="bb" Url="aa" Desc="aa" />
<Link Cat="cc" Url="aa" Desc="aa" />
&l ......
1 using System;
2 using System.Collections;
3 using System.Configuration;
4 using System.Data;
5 using System.Linq;
6 using System.Web;
7 using System.Web.Security;
8 using&nbs ......
ÔÚC#.netÖÐÈçºÎ²Ù×÷XML
ÔÚC#.netÖÐÈçºÎ²Ù×÷XML
¿ÉÄܺܶàÅóÓÑ»¹Ã»ÓнøÐйýXML²Ù×÷,Ï£ÍûÏÂÃæÕâƪÎÄÕÂÄܶԴó¼ÒÓаïÖú.»òÕß×Ô¼º¸´ÖÆһϴúÂëÊÔÒ»ÏÂ.ÕâƪÎÄÕ²»ÊÇÎÒдµÄ.ÎÒÖ»ÊÇת¹ýÀ´.¾õµÃ²»´í.
ÐèÒªÌí¼ÓµÄÃüÃû¿Õ¼ä£º
using System.Xml;
¶¨Ò弸¸ö¹«¹²¶ÔÏó£º
XmlDocument xmldoc ;
XmlNode xmlnode ;
XmlElement xmlele ......
1¡¢C/C++³ÌÐòÔ±Çë×¢Ò⣬²»ÄÜÔÚcaseÓï¾ä²»Îª¿Õʱ“ÏòÏÂÖ´ÐД¡£
2¡¢ÖµÀàÐͺÍÒýÓÃÀàÐÍÖ®¼äµÄÇø±ð£ºC#µÄ»ù±¾ÀàÐÍ£¨int£¬charµÈ£©¶¼ÊÇÖµÀàÐÍ£¬ÊÇÔÚÕ»Öд´½¨µÄ¡£¶ø¶ÔÏóÊÇÒýÓÃÀàÐÍ£¬´´½¨ÓÚ¶ÑÖУ¬ÐèҪʹÓùؼü×Önew¡£
3¡¢ÔÚC#ÖÐͨ¹ýʵÀý·ÃÎʾ²Ì¬·½·¨»ò³ÉÔ±±äÁ¿ÊDz»ºÏ·¨µÄ£¬»áÉú³É±àÒëÆ÷´íÎó¡£µ«ÊÇÎÒÃÇ¿ÉÒÔͨ¹ýÉùÃ÷ËûÃÇ ......
using System;
using System.Collections.Generic;
using System.Text;
using System.Security.Cryptography;//CryptographyÃÜÂëÊõ
namespace DAL
{
public class Enc ......