91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 119KB
    文件類型: .zip
    金幣: 2
    下載: 0 次
    發布日期: 2021-05-14
  • 語言: 其他
  • 標簽: Excel??文件??替換??

資源簡介

這工作需要做的一個小東西,用處就是2個excel文件中有,用其中1個excel文件中的數據替換另一個excel文件中的一個數據的某幾個值,就是2個excel進行比對,替換其中1個excel中的數據。 里邊的excel列需要替換,現在里邊還是原來的值,自己修改修改就能使用了。

資源截圖

代碼片段和文件信息

using?System;
using?System.Collections.Generic;
using?System.ComponentModel;
using?System.Data;
using?System.Data.SqlClient;
using?System.Drawing;
using?System.Linq;
using?System.Text;
using?System.Windows.Forms;
using?System.Reflection;
using?System.Data.OleDb;
using?org.in2bits.MyXls;

namespace?Excel比對替換
{
????public?partial?class?Form1?:?Form
????{
????????public?Form1()
????????{
????????????InitializeComponent();
????????}

????????private?void?button5_Click(object?sender?EventArgs?e)
????????{
????????????this.Close();
????????}

????????private?void?Form1_Load(object?sender?EventArgs?e)
????????{
????????????splitContainer1.SplitterDistance?=?splitContainer1.Width?/?2;

????????????openFileDialog1.Filter?=?“Excel?97-2003文件(*.xls)|*.xls|Excel?2007文件(*.xlsx)|*.xlsx“;

????????????openFileDialog1.FilterIndex?=?2;

????????????openFileDialog1.RestoreDirectory?=?true;

??????????saveFileDialog1.Filter?=?“Excel?97-2003文件(*.xls)|*.xls“;

????????}

????????private?void?button1_Click(object?sender?EventArgs?e)
????????{
????????????
????????????DialogResult?dg=openFileDialog1.ShowDialog();??

????????????if?(dg?==?DialogResult.OK?||?dg?==?DialogResult.Yes)
????????????{
????????????????
????????????????????DataSet?myDs?=?new?DataSet();

????????????????????string?mystring=““;

????????????????????if?(openFileDialog1.FileName.Length?-?openFileDialog1.FileName.LastIndexOf(“.xls“)?==?4)
????????????????????{
????????????????????????mystring?=?“Provider?=?Microsoft.Jet.OLEDB.4.0?;?Data?Source?=?‘“?+?openFileDialog1.FileName?+?“‘;Extended?Properties=Excel?8.0“;
????????????????????}
????????????????????if?(openFileDialog1.FileName.Length?-?openFileDialog1.FileName.LastIndexOf(“.xlsx“)?==?5)
????????????????????{
????????????????????????mystring?=?“Provider?=?Microsoft.Ace.OLEDB.12.0?;?Data?Source?=?‘“?+?openFileDialog1.FileName?+?“‘;Extended?Properties=Excel?12.0“;
????????????????????}
????????????????????if?(mystring?!=?““)
????????????????????{
????????????????????????OleDbConnection?cnnxls?=?new?OleDbConnection(mystring);

????????????????????????cnnxls.Open();

????????????????????????//mystring?=?cnnxls.GetOleDbSchemaTable(OleDbSchemaGuid.Tables?new?object[]?{?null?null?null?“TABLE“?}).Rows[0][“TABLE_NAME“].ToString();
????????????????????????????
????????????????????????OleDbDataAdapter?myDa?=?new?OleDbDataAdapter(“select?*?from?[Sheet1$]“?cnnxls);

????????????????????????//OleDbDataAdapter?myDa?=?new?OleDbDataAdapter(“select?*?from?[“+mystring+“]“?cnnxls);

????????????????????????myDa.Fill(myDs);

????????????????????????dataGridView1.DataSource?=?myDs.Tables[0];

????????????????????????cnnxls.Close();

????????????????????????//MessageBox.Show(mystring);
????????????????????}
????????????????????else
????????????????????{
????????????????????????MessageBox.Show(“打開文件失敗,請重試!“);
????????????????????}


????????????}
????????????else
????????????

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2013-01-31?08:49??Excel比對替換\
?????文件????????5309??2012-10-31?11:04??Excel比對替換\Excel比對替換.csproj
?????文件???????10602??2012-10-31?09:29??Excel比對替換\Form1.Designer.cs
?????文件???????14265??2012-10-31?11:24??Excel比對替換\Form1.cs
?????文件????????6224??2012-10-31?09:29??Excel比對替換\Form1.resx
?????文件????????3231??2012-10-31?11:19??Excel比對替換\Form2.Designer.cs
?????文件?????????456??2012-10-31?11:19??Excel比對替換\Form2.cs
?????文件????????5817??2012-10-31?11:19??Excel比對替換\Form2.resx
?????文件?????????498??2012-10-30?16:19??Excel比對替換\Program.cs
?????目錄???????????0??2012-10-30?16:19??Excel比對替換\Properties\
?????文件????????1366??2012-10-30?16:19??Excel比對替換\Properties\AssemblyInfo.cs
?????文件????????2884??2012-10-30?16:19??Excel比對替換\Properties\Resources.Designer.cs
?????文件????????5612??2012-10-30?16:19??Excel比對替換\Properties\Resources.resx
?????文件????????1102??2012-10-30?16:19??Excel比對替換\Properties\Settings.Designer.cs
?????文件?????????249??2012-10-30?16:19??Excel比對替換\Properties\Settings.settings
?????目錄???????????0??2012-10-30?16:19??Excel比對替換\bin\
?????目錄???????????0??2012-10-30?19:30??Excel比對替換\bin\Debug\
?????文件???????18432??2012-10-31?14:42??Excel比對替換\bin\Debug\Excel比對替換.exe
?????文件???????36352??2012-10-31?14:42??Excel比對替換\bin\Debug\Excel比對替換.pdb
?????文件???????11600??2013-01-31?08:48??Excel比對替換\bin\Debug\Excel比對替換.vshost.exe
?????文件?????????490??2010-03-17?22:39??Excel比對替換\bin\Debug\Excel比對替換.vshost.exe.manifest
?????文件??????130048??2009-08-19?16:38??Excel比對替換\bin\Debug\MyXls.SL2.dll
?????文件??????????36??2011-10-29?14:20??Excel比對替換\bin\Debug\MyXls.SL2.dll.refresh
?????目錄???????????0??2012-10-30?16:19??Excel比對替換\obj\
?????目錄???????????0??2012-10-30?16:19??Excel比對替換\obj\x86\
?????目錄???????????0??2013-01-28?10:54??Excel比對替換\obj\x86\Debug\
?????文件????????8631??2013-01-28?10:54??Excel比對替換\obj\x86\Debug\DesignTimeResolveAssemblyReferences.cache
?????文件????????6646??2012-10-31?14:42??Excel比對替換\obj\x86\Debug\DesignTimeResolveAssemblyReferencesInput.cache
?????文件?????????180??2012-10-31?11:04??Excel比對替換\obj\x86\Debug\Excel比對替換.Form1.resources
?????文件?????????180??2012-10-31?11:20??Excel比對替換\obj\x86\Debug\Excel比對替換.Form2.resources
?????文件?????????180??2012-10-31?11:04??Excel比對替換\obj\x86\Debug\Excel比對替換.Properties.Resources.resources
............此處省略10個文件信息

評論

共有 條評論