Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö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 Î


Ïà¹ØÎĵµ£º

C#¶ÁдXMLÎļþ

1£©
XMLÊÇÒ»ÏîÈÈÃŵļ¼Êõ¡£ËüÖ®ËùÒÔÄܹ»ÒýÆðÈËÃǵÄÐËȤ£¬Ò»¸öÖ÷ÒªµÄÔ­ÒòÔÚÓÚËüÊ®·ÖµÄ¼òµ¥£¬ÈËÃÇ¿ÉÒÔºÜÈÝÒ×µØÀí½âºÍʹÓÃËü¡£Ã¿Ò»¸ö³ÌÐòÔ±¶¼ÄÜÇáÒ׵ؿ´¶®Ò»¸öXMLÎļþ£¬Àí½âËü°üº¬µÄÄÚÈÝ¡£
.NETÖаüº¬Á˺ܶàÖ§³ÖXMLµÄÀ࣬ÕâЩÀàʹµÃ³ÌÐòԱʹÓÃXML±à³Ì¾ÍÈçͬÀí½âXMLÎļþÒ»Ñù¼òµ¥¡£ÔÚÕâƪÎÄÕÂÖУ¬ÎÒ½«¸ø³öÕâÑùµÄÒ»¸öÀàµÄʹÓÃʾ ......

C#²éѯÊý¾Ý¿â°Ñ½á¹ûÊä³öµ½XMLµÄÀý×Ó

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using System.Data;
namespace ConsoleApplication4
{
class Program
{
static void Main(string[] args)
{
//sqlserverÉí·ÝÑéÖ¤
//s ......

C#´´½¨XML

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
ÔÚC#.netÖÐÈçºÎ²Ù×÷XML
¿ÉÄܺܶàÅóÓÑ»¹Ã»ÓнøÐйýXML²Ù×÷,Ï£ÍûÏÂÃæÕâƪÎÄÕÂÄܶԴó¼ÒÓаïÖú.»òÕß×Ô¼º¸´ÖÆһϴúÂëÊÔÒ»ÏÂ.ÕâƪÎÄÕ²»ÊÇÎÒдµÄ.ÎÒÖ»ÊÇת¹ýÀ´.¾õµÃ²»´í.
ÐèÒªÌí¼ÓµÄÃüÃû¿Õ¼ä£º
using System.Xml;
¶¨Ò弸¸ö¹«¹²¶ÔÏó£º
XmlDocument xmldoc ;
XmlNode xmlnode ;
XmlElement xmlele ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ