資源簡介
Q758437.zip c#中如何將datagridview中的數據存入access數據庫 https://ask.csdn.net/questions/758437

代碼片段和文件信息
using?System;
using?System.Collections.Generic;
using?System.ComponentModel;
using?System.Data;
using?System.Data.OleDb;
using?System.Drawing;
using?System.Linq;
using?System.Text;
using?System.Windows.Forms;
namespace?Q758437
{
????public?partial?class?Form1?:?Form
????{
????????public?Form1()
????????{
????????????InitializeComponent();
????????}
????????OleDbDataAdapter?adp;
????????private?void?button1_Click(object?sender?EventArgs?e)
????????{
????????????OleDbConnection?conn?=?new?OleDbConnection(@“Provider=Microsoft.Jet.OLEDB.4.0;Data?Source=““C:\Documents?and?Settings\Cao?Zhongyan\My?Documents\Visual?Studio?2010\Projects\Q758437\Q758437\db1.mdb“““);
????????????adp?=?new?OleDbDataAdapter(“select?*?from?table1“?conn);
????????????DataTable?dt?=?new?DataTable();
????????????adp.Fill(dt);
????????????dataGridView1.DataSource?=?dt;
????????}
????????private?void?button2_Click(object?sender?EventArgs?e)
????????{
????????????if?(adp?==?null)?return;
????????????var?dt?=?(DataTable)dataGridView1.DataSource;
????????????OleDbCommandBuilder?cmdb?=?new?OleDbCommandBuilder(adp);
????????????adp.Update(dt);
????????}
????}
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件?????????863??2019-04-25?08:29??Q758437\Q758437.sln
?????文件???????19456??2019-04-25?08:48??Q758437\Q758437.suo
?????目錄???????????0??2019-04-25?08:48??Q758437\Q758437\
?????目錄???????????0??2019-04-25?08:29??Q758437\Q758437\bin\
?????目錄???????????0??2019-04-25?08:36??Q758437\Q758437\bin\Debug\
?????文件????????9216??2019-04-25?08:44??Q758437\Q758437\bin\Debug\Q758437.exe
?????文件???????26112??2019-04-25?08:44??Q758437\Q758437\bin\Debug\Q758437.pdb
?????文件???????11600??2019-04-25?08:29??Q758437\Q758437\bin\Debug\Q758437.vshost.exe
?????文件?????????490??2010-03-17?22:39??Q758437\Q758437\bin\Debug\Q758437.vshost.exe.manifest
?????文件??????143360??2019-04-25?08:47??Q758437\Q758437\db1.mdb
?????文件????????1189??2019-04-25?08:44??Q758437\Q758437\Form1.cs
?????文件????????3482??2019-04-25?08:39??Q758437\Q758437\Form1.Designer.cs
?????文件????????5817??2019-04-25?08:39??Q758437\Q758437\Form1.resx
?????目錄???????????0??2019-04-25?08:29??Q758437\Q758437\obj\
?????目錄???????????0??2019-04-25?08:29??Q758437\Q758437\obj\x86\
?????目錄???????????0??2019-04-25?08:44??Q758437\Q758437\obj\x86\Debug\
?????文件????????2152??2019-04-25?08:29??Q758437\Q758437\obj\x86\Debug\DesignTimeResolveAssemblyReferences.cache
?????文件????????6386??2019-04-25?08:44??Q758437\Q758437\obj\x86\Debug\DesignTimeResolveAssemblyReferencesInput.cache
?????文件?????????468??2019-04-25?08:39??Q758437\Q758437\obj\x86\Debug\GenerateResource.read.1.tlog
?????文件????????1034??2019-04-25?08:39??Q758437\Q758437\obj\x86\Debug\GenerateResource.write.1.tlog
?????文件????????1192??2019-04-25?08:36??Q758437\Q758437\obj\x86\Debug\Q758437.csproj.FileListAbsolute.txt
?????文件????????9216??2019-04-25?08:44??Q758437\Q758437\obj\x86\Debug\Q758437.exe
?????文件?????????180??2019-04-25?08:39??Q758437\Q758437\obj\x86\Debug\Q758437.Form1.resources
?????文件???????26112??2019-04-25?08:44??Q758437\Q758437\obj\x86\Debug\Q758437.pdb
?????文件?????????180??2019-04-25?08:36??Q758437\Q758437\obj\x86\Debug\Q758437.Properties.Resources.resources
?????目錄???????????0??2019-04-25?08:29??Q758437\Q758437\obj\x86\Debug\TempPE\
?????文件?????????499??2019-04-25?08:29??Q758437\Q758437\Program.cs
?????目錄???????????0??2019-04-25?08:29??Q758437\Q758437\Properties\
?????文件????????1426??2019-04-25?08:29??Q758437\Q758437\Properties\AssemblyInfo.cs
?????文件????????2840??2019-04-25?08:29??Q758437\Q758437\Properties\Resources.Designer.cs
?????文件????????5612??2019-04-25?08:29??Q758437\Q758437\Properties\Resources.resx
............此處省略3個文件信息
評論
共有 條評論