xxxx18一60岁hd中国/日韩女同互慰一区二区/西西人体扒开双腿无遮挡/日韩欧美黄色一级片 - 色护士精品影院www

  • 大小: 49.96 KB
    文件類型: .rar
    金幣: 1
    下載: 1 次
    發布日期: 2024-11-27
  • 語言: C#
  • 標簽: dataset??事務??數據插入??

資源簡介

一個源碼,包括10個例,說明數據表的合并,數據的不重復插入,以事務更新多個數據表以批量數據導入導出數據庫
大大有益啊。。。。

資源截圖

代碼片段和文件信息

using?System;
using?System.Collections.Generic;
using?System.ComponentModel;
using?System.Data;
using?System.Drawing;
using?System.Text;
using?System.Windows.Forms;

using?System.Data.SqlClient;
using??System.Transactions;

namespace?WindowsApplication1
{
????public?partial?class?Form1?:?Form
????{
????????public?Form1()
????????{
????????????InitializeComponent();
????????}

????????private?void?button1_Click(object?sender?EventArgs?e)
????????{//避免增加除主鍵外的相同記錄
???????????string?MyCompanyName=“深圳唯佳物流公司“;
???????????string?MyPhone=“0589-86523158“;
???????????string?MySQL=“SELECT?*?FROM?Shippers“;
???????????string?MyConnectionString=“Data?Source?=?.;Database?=? Northwind;Integrated?Security=SSPI“;???????????
???????????SqlDataAdapter??MyAdapter=new?SqlDataAdapter(MySQLMyConnectionString);
???????????SqlCommandBuilder?MyBuilder=new?SqlCommandBuilder(MyAdapter);
???????????DataSet?MySet=new?DataSet();
???????????MyAdapter.Fill(MySet?“Shippers“);
???????????DataColumn?[]MyKeys=new?DataColumn[2];
???????????MyKeys[0]?=?MySet.Tables[“Shippers“].Columns[“CompanyName“];
???????????MyKeys[1]?=?MySet.Tables[“Shippers“].Columns[“Phone“];
???????????MySet.Tables[“Shippers“].PrimaryKey?=?MyKeys;
???????????string[]?MySupplier?=?{MyCompanyName?MyPhone};
???????????DataRow?MyFindRow?=?MySet.Tables[“Shippers“].Rows.Find(MySupplier);
???????????if?(MyFindRow?==?null)
???????????{
???????????????DataRow?MyNewRow?=MySet.Tables[“Shippers“].NewRow();
???????????????MyNewRow[“CompanyName“]?=?MySupplier[0];
???????????????MyNewRow[“Phone“]?=?MySupplier[1];
???????????????MySet.Tables[“Shippers“].Rows.Add(MyNewRow);
???????????????MyAdapter.Update(MySet?“Shippers“);
???????????????MessageBox.Show(“增加記錄操作成功!“?“信息提示“?MessageBoxButtons.OK?MessageBoxIcon.Information);
???????????}
???????????else
???????????????MessageBox.Show(“該記錄已經存在!“?“信息提示“?MessageBoxButtons.OK?MessageBoxIcon.Information);???????????????????
????????}

????????private?void?button2_Click(object?sender?EventArgs?e)
????????{//以參數化方式增加數據庫記錄
???????????string?MyCompanyName=“深圳唯佳物流公司“;
???????????string?MyPhone=“0589-86523158“;
???????????string?MyConnectionString=“Data?Source?=?.;Database?=? Northwind;Integrated?Security=SSPI“;???????????
???????????SqlConnection?MyConnection=null;
???????????try
???????????{
?????????????MyConnection=new?SqlConnection(MyConnectionString);
?????????????MyConnection.Open();
?????????????SqlCommand?MyCommand=MyConnection.CreateCommand();
?????????????MyCommand.CommandText?=?“INSERT?INTO?Shippers?VALUES(@CompanyName?@Phone)“;
?????????????MyCommand.Parameters.Add(new?SqlParameter(“@CompanyName“?SqlDbType.VarChar30));
?????????????MyCommand.Parameters.Add(new?SqlParameter(“@Phone“?SqlDbType.VarChar?30));
?????????????MyCommand.Prepare();
?????????????MyCommand.Parameters[“@CompanyName“].Value?=MyCompanyName;
?????????????MyCommand.Parameters[“@Phone“].Value?=MyPhone;
?????????????MyCommand.Execut

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----

?????文件????????946??2006-05-30?15:27??N019\WindowsApplication1.sln

????..A..H.?????14848??2006-11-30?13:40??N019\WindowsApplication1.suo

?????文件???????8971??2006-08-14?00:32??N019\WindowsApplication1\Form1.Designer.cs

?????文件??????20074??2006-08-14?00:44??N019\WindowsApplication1\Form1.cs

?????文件???????5814??2006-08-14?00:32??N019\WindowsApplication1\Form1.resx

?????文件????????478??2006-05-30?15:27??N019\WindowsApplication1\Program.cs

?????文件???????3294??2006-07-25?22:09??N019\WindowsApplication1\WindowsApplication1.csproj

?????文件???????1210??2006-05-30?15:27??N019\WindowsApplication1\Properties\AssemblyInfo.cs

?????文件???????2892??2006-05-30?15:27??N019\WindowsApplication1\Properties\Resources.Designer.cs

?????文件???????5612??2006-05-30?15:27??N019\WindowsApplication1\Properties\Resources.resx

?????文件???????1102??2006-05-30?15:27??N019\WindowsApplication1\Properties\Settings.Designer.cs

?????文件????????249??2006-05-30?15:27??N019\WindowsApplication1\Properties\Settings.settings

?????文件???????5632??2005-11-11?22:25??N019\WindowsApplication1\bin\Debug\WindowsApplication1.vshost.exe

?????文件??????28672??2008-12-06?09:49??N019\WindowsApplication1\bin\Release\WindowsApplication1.exe

?????文件??????38400??2008-12-06?09:49??N019\WindowsApplication1\bin\Release\WindowsApplication1.pdb

?????文件???????5632??2005-11-11?22:25??N019\WindowsApplication1\bin\Release\WindowsApplication1.vshost.exe

?????文件????????368??2006-11-30?13:29??N019\WindowsApplication1\obj\WindowsApplication1.csproj.FileList.txt

?????文件????????180??2008-12-06?09:49??N019\WindowsApplication1\obj\Release\WindowsApplication1.Form1.resources

?????文件????????180??2008-12-06?09:49??N019\WindowsApplication1\obj\Release\WindowsApplication1.Properties.Resources.resources

?????文件??????28672??2008-12-06?09:49??N019\WindowsApplication1\obj\Release\WindowsApplication1.exe

?????文件??????38400??2008-12-06?09:49??N019\WindowsApplication1\obj\Release\WindowsApplication1.pdb

?????文件????????842??2008-12-06?09:49??N019\WindowsApplication1\obj\Release\WindowsApplication1.csproj.GenerateResource.Cache

?????文件????????824??2008-12-06?09:51??N019\WindowsApplication1\obj\WindowsApplication1.csproj.FileListAbsolute.txt

????..AD...?????????0??2007-11-23?13:28??N019\WindowsApplication1\obj\Debug\TempPE

????..AD...?????????0??2007-11-23?13:28??N019\WindowsApplication1\obj\Release\TempPE

????..AD...?????????0??2007-11-23?13:28??N019\WindowsApplication1\bin\Debug

????..AD...?????????0??2007-11-23?13:28??N019\WindowsApplication1\bin\Release

????..AD...?????????0??2007-11-23?13:28??N019\WindowsApplication1\obj\Debug

????..AD...?????????0??2007-11-23?13:28??N019\WindowsApplication1\obj\Release

????..AD...?????????0??2007-11-23?13:28??N019\WindowsApplication1\Properties

............此處省略7個文件信息

評論

共有 條評論