13 changed files with 1418 additions and 143 deletions
-
121Form1.Designer.cs
-
107Form1.cs
-
24Form1.resx
-
60ProgressForm.Designer.cs
-
25ProgressForm.cs
-
120ProgressForm.resx
-
72ShowForm.Designer.cs
-
20ShowForm.cs
-
120ShowForm.resx
-
273UpgradeLog.htm
-
206Utility/MySQLUtilityClass.cs
-
207Utility/OracleUtilityClass.cs
-
204Utility/PostgreSQLUtilityClass.cs
@ -0,0 +1,60 @@ |
|||
|
|||
namespace ExportDataToFile |
|||
{ |
|||
partial class ProgressForm |
|||
{ |
|||
/// <summary>
|
|||
/// Required designer variable.
|
|||
/// </summary>
|
|||
private System.ComponentModel.IContainer components = null; |
|||
|
|||
/// <summary>
|
|||
/// Clean up any resources being used.
|
|||
/// </summary>
|
|||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
|||
protected override void Dispose(bool disposing) |
|||
{ |
|||
if (disposing && (components != null)) |
|||
{ |
|||
components.Dispose(); |
|||
} |
|||
base.Dispose(disposing); |
|||
} |
|||
|
|||
#region Windows Form Designer generated code
|
|||
|
|||
/// <summary>
|
|||
/// Required method for Designer support - do not modify
|
|||
/// the contents of this method with the code editor.
|
|||
/// </summary>
|
|||
private void InitializeComponent() |
|||
{ |
|||
this.pbExport = new System.Windows.Forms.ProgressBar(); |
|||
this.SuspendLayout(); |
|||
//
|
|||
// pbExport
|
|||
//
|
|||
this.pbExport.Location = new System.Drawing.Point(12, 12); |
|||
this.pbExport.Name = "pbExport"; |
|||
this.pbExport.Size = new System.Drawing.Size(297, 23); |
|||
this.pbExport.TabIndex = 1; |
|||
//
|
|||
// ProgressForm
|
|||
//
|
|||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); |
|||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; |
|||
this.CausesValidation = false; |
|||
this.ClientSize = new System.Drawing.Size(320, 44); |
|||
this.ControlBox = false; |
|||
this.Controls.Add(this.pbExport); |
|||
this.Name = "ProgressForm"; |
|||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; |
|||
this.Text = "匯出進度表"; |
|||
this.ResumeLayout(false); |
|||
|
|||
} |
|||
|
|||
#endregion
|
|||
public System.Windows.Forms.ProgressBar pbExport; |
|||
} |
|||
} |
@ -0,0 +1,25 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.ComponentModel; |
|||
using System.Data; |
|||
using System.Drawing; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
using System.Windows.Forms; |
|||
|
|||
namespace ExportDataToFile |
|||
{ |
|||
public partial class ProgressForm : Form |
|||
{ |
|||
public ProgressForm() |
|||
{ |
|||
InitializeComponent(); |
|||
} |
|||
|
|||
private void button1_Click(object sender, EventArgs e) |
|||
{ |
|||
pbExport.Value += 1; |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,120 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<root> |
|||
<!-- |
|||
Microsoft ResX Schema |
|||
|
|||
Version 2.0 |
|||
|
|||
The primary goals of this format is to allow a simple XML format |
|||
that is mostly human readable. The generation and parsing of the |
|||
various data types are done through the TypeConverter classes |
|||
associated with the data types. |
|||
|
|||
Example: |
|||
|
|||
... ado.net/XML headers & schema ... |
|||
<resheader name="resmimetype">text/microsoft-resx</resheader> |
|||
<resheader name="version">2.0</resheader> |
|||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> |
|||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> |
|||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> |
|||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> |
|||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> |
|||
<value>[base64 mime encoded serialized .NET Framework object]</value> |
|||
</data> |
|||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> |
|||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> |
|||
<comment>This is a comment</comment> |
|||
</data> |
|||
|
|||
There are any number of "resheader" rows that contain simple |
|||
name/value pairs. |
|||
|
|||
Each data row contains a name, and value. The row also contains a |
|||
type or mimetype. Type corresponds to a .NET class that support |
|||
text/value conversion through the TypeConverter architecture. |
|||
Classes that don't support this are serialized and stored with the |
|||
mimetype set. |
|||
|
|||
The mimetype is used for serialized objects, and tells the |
|||
ResXResourceReader how to depersist the object. This is currently not |
|||
extensible. For a given mimetype the value must be set accordingly: |
|||
|
|||
Note - application/x-microsoft.net.object.binary.base64 is the format |
|||
that the ResXResourceWriter will generate, however the reader can |
|||
read any of the formats listed below. |
|||
|
|||
mimetype: application/x-microsoft.net.object.binary.base64 |
|||
value : The object must be serialized with |
|||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter |
|||
: and then encoded with base64 encoding. |
|||
|
|||
mimetype: application/x-microsoft.net.object.soap.base64 |
|||
value : The object must be serialized with |
|||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter |
|||
: and then encoded with base64 encoding. |
|||
|
|||
mimetype: application/x-microsoft.net.object.bytearray.base64 |
|||
value : The object must be serialized into a byte array |
|||
: using a System.ComponentModel.TypeConverter |
|||
: and then encoded with base64 encoding. |
|||
--> |
|||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> |
|||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> |
|||
<xsd:element name="root" msdata:IsDataSet="true"> |
|||
<xsd:complexType> |
|||
<xsd:choice maxOccurs="unbounded"> |
|||
<xsd:element name="metadata"> |
|||
<xsd:complexType> |
|||
<xsd:sequence> |
|||
<xsd:element name="value" type="xsd:string" minOccurs="0" /> |
|||
</xsd:sequence> |
|||
<xsd:attribute name="name" use="required" type="xsd:string" /> |
|||
<xsd:attribute name="type" type="xsd:string" /> |
|||
<xsd:attribute name="mimetype" type="xsd:string" /> |
|||
<xsd:attribute ref="xml:space" /> |
|||
</xsd:complexType> |
|||
</xsd:element> |
|||
<xsd:element name="assembly"> |
|||
<xsd:complexType> |
|||
<xsd:attribute name="alias" type="xsd:string" /> |
|||
<xsd:attribute name="name" type="xsd:string" /> |
|||
</xsd:complexType> |
|||
</xsd:element> |
|||
<xsd:element name="data"> |
|||
<xsd:complexType> |
|||
<xsd:sequence> |
|||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> |
|||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> |
|||
</xsd:sequence> |
|||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> |
|||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> |
|||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> |
|||
<xsd:attribute ref="xml:space" /> |
|||
</xsd:complexType> |
|||
</xsd:element> |
|||
<xsd:element name="resheader"> |
|||
<xsd:complexType> |
|||
<xsd:sequence> |
|||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> |
|||
</xsd:sequence> |
|||
<xsd:attribute name="name" type="xsd:string" use="required" /> |
|||
</xsd:complexType> |
|||
</xsd:element> |
|||
</xsd:choice> |
|||
</xsd:complexType> |
|||
</xsd:element> |
|||
</xsd:schema> |
|||
<resheader name="resmimetype"> |
|||
<value>text/microsoft-resx</value> |
|||
</resheader> |
|||
<resheader name="version"> |
|||
<value>2.0</value> |
|||
</resheader> |
|||
<resheader name="reader"> |
|||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> |
|||
</resheader> |
|||
<resheader name="writer"> |
|||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> |
|||
</resheader> |
|||
</root> |
@ -0,0 +1,72 @@ |
|||
|
|||
namespace ExportDataToFile |
|||
{ |
|||
partial class ShowForm |
|||
{ |
|||
/// <summary>
|
|||
/// Required designer variable.
|
|||
/// </summary>
|
|||
private System.ComponentModel.IContainer components = null; |
|||
|
|||
/// <summary>
|
|||
/// Clean up any resources being used.
|
|||
/// </summary>
|
|||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
|||
protected override void Dispose(bool disposing) |
|||
{ |
|||
if (disposing && (components != null)) |
|||
{ |
|||
components.Dispose(); |
|||
} |
|||
base.Dispose(disposing); |
|||
} |
|||
|
|||
#region Windows Form Designer generated code
|
|||
|
|||
/// <summary>
|
|||
/// Required method for Designer support - do not modify
|
|||
/// the contents of this method with the code editor.
|
|||
/// </summary>
|
|||
private void InitializeComponent() |
|||
{ |
|||
this.dgvShowResult = new System.Windows.Forms.DataGridView(); |
|||
((System.ComponentModel.ISupportInitialize)(this.dgvShowResult)).BeginInit(); |
|||
this.SuspendLayout(); |
|||
//
|
|||
// dgvShowResult
|
|||
//
|
|||
this.dgvShowResult.AllowUserToAddRows = false; |
|||
this.dgvShowResult.AllowUserToDeleteRows = false; |
|||
this.dgvShowResult.AllowUserToOrderColumns = true; |
|||
this.dgvShowResult.AllowUserToResizeRows = false; |
|||
this.dgvShowResult.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) |
|||
| System.Windows.Forms.AnchorStyles.Left) |
|||
| System.Windows.Forms.AnchorStyles.Right))); |
|||
this.dgvShowResult.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; |
|||
this.dgvShowResult.Location = new System.Drawing.Point(12, 12); |
|||
this.dgvShowResult.Name = "dgvShowResult"; |
|||
this.dgvShowResult.RowTemplate.Height = 24; |
|||
this.dgvShowResult.Size = new System.Drawing.Size(1271, 600); |
|||
this.dgvShowResult.TabIndex = 0; |
|||
//
|
|||
// ShowForm
|
|||
//
|
|||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); |
|||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; |
|||
this.ClientSize = new System.Drawing.Size(1295, 624); |
|||
this.Controls.Add(this.dgvShowResult); |
|||
this.MaximizeBox = false; |
|||
this.MinimizeBox = false; |
|||
this.Name = "ShowForm"; |
|||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; |
|||
this.Text = "顯示資料"; |
|||
((System.ComponentModel.ISupportInitialize)(this.dgvShowResult)).EndInit(); |
|||
this.ResumeLayout(false); |
|||
|
|||
} |
|||
|
|||
#endregion
|
|||
|
|||
public System.Windows.Forms.DataGridView dgvShowResult; |
|||
} |
|||
} |
@ -0,0 +1,20 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.ComponentModel; |
|||
using System.Data; |
|||
using System.Drawing; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
using System.Windows.Forms; |
|||
|
|||
namespace ExportDataToFile |
|||
{ |
|||
public partial class ShowForm : Form |
|||
{ |
|||
public ShowForm() |
|||
{ |
|||
InitializeComponent(); |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,120 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<root> |
|||
<!-- |
|||
Microsoft ResX Schema |
|||
|
|||
Version 2.0 |
|||
|
|||
The primary goals of this format is to allow a simple XML format |
|||
that is mostly human readable. The generation and parsing of the |
|||
various data types are done through the TypeConverter classes |
|||
associated with the data types. |
|||
|
|||
Example: |
|||
|
|||
... ado.net/XML headers & schema ... |
|||
<resheader name="resmimetype">text/microsoft-resx</resheader> |
|||
<resheader name="version">2.0</resheader> |
|||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> |
|||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> |
|||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> |
|||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> |
|||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> |
|||
<value>[base64 mime encoded serialized .NET Framework object]</value> |
|||
</data> |
|||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> |
|||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> |
|||
<comment>This is a comment</comment> |
|||
</data> |
|||
|
|||
There are any number of "resheader" rows that contain simple |
|||
name/value pairs. |
|||
|
|||
Each data row contains a name, and value. The row also contains a |
|||
type or mimetype. Type corresponds to a .NET class that support |
|||
text/value conversion through the TypeConverter architecture. |
|||
Classes that don't support this are serialized and stored with the |
|||
mimetype set. |
|||
|
|||
The mimetype is used for serialized objects, and tells the |
|||
ResXResourceReader how to depersist the object. This is currently not |
|||
extensible. For a given mimetype the value must be set accordingly: |
|||
|
|||
Note - application/x-microsoft.net.object.binary.base64 is the format |
|||
that the ResXResourceWriter will generate, however the reader can |
|||
read any of the formats listed below. |
|||
|
|||
mimetype: application/x-microsoft.net.object.binary.base64 |
|||
value : The object must be serialized with |
|||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter |
|||
: and then encoded with base64 encoding. |
|||
|
|||
mimetype: application/x-microsoft.net.object.soap.base64 |
|||
value : The object must be serialized with |
|||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter |
|||
: and then encoded with base64 encoding. |
|||
|
|||
mimetype: application/x-microsoft.net.object.bytearray.base64 |
|||
value : The object must be serialized into a byte array |
|||
: using a System.ComponentModel.TypeConverter |
|||
: and then encoded with base64 encoding. |
|||
--> |
|||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> |
|||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> |
|||
<xsd:element name="root" msdata:IsDataSet="true"> |
|||
<xsd:complexType> |
|||
<xsd:choice maxOccurs="unbounded"> |
|||
<xsd:element name="metadata"> |
|||
<xsd:complexType> |
|||
<xsd:sequence> |
|||
<xsd:element name="value" type="xsd:string" minOccurs="0" /> |
|||
</xsd:sequence> |
|||
<xsd:attribute name="name" use="required" type="xsd:string" /> |
|||
<xsd:attribute name="type" type="xsd:string" /> |
|||
<xsd:attribute name="mimetype" type="xsd:string" /> |
|||
<xsd:attribute ref="xml:space" /> |
|||
</xsd:complexType> |
|||
</xsd:element> |
|||
<xsd:element name="assembly"> |
|||
<xsd:complexType> |
|||
<xsd:attribute name="alias" type="xsd:string" /> |
|||
<xsd:attribute name="name" type="xsd:string" /> |
|||
</xsd:complexType> |
|||
</xsd:element> |
|||
<xsd:element name="data"> |
|||
<xsd:complexType> |
|||
<xsd:sequence> |
|||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> |
|||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> |
|||
</xsd:sequence> |
|||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> |
|||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> |
|||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> |
|||
<xsd:attribute ref="xml:space" /> |
|||
</xsd:complexType> |
|||
</xsd:element> |
|||
<xsd:element name="resheader"> |
|||
<xsd:complexType> |
|||
<xsd:sequence> |
|||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> |
|||
</xsd:sequence> |
|||
<xsd:attribute name="name" type="xsd:string" use="required" /> |
|||
</xsd:complexType> |
|||
</xsd:element> |
|||
</xsd:choice> |
|||
</xsd:complexType> |
|||
</xsd:element> |
|||
</xsd:schema> |
|||
<resheader name="resmimetype"> |
|||
<value>text/microsoft-resx</value> |
|||
</resheader> |
|||
<resheader name="version"> |
|||
<value>2.0</value> |
|||
</resheader> |
|||
<resheader name="reader"> |
|||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> |
|||
</resheader> |
|||
<resheader name="writer"> |
|||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> |
|||
</resheader> |
|||
</root> |
@ -0,0 +1,273 @@ |
|||
<!DOCTYPE html> |
|||
<!-- saved from url=(0014)about:internet --> |
|||
<html xmlns:msxsl="urn:schemas-microsoft-com:xslt"><head><meta content="en-us" http-equiv="Content-Language" /><meta content="text/html; charset=utf-16" http-equiv="Content-Type" /><title _locID="ConversionReport0"> |
|||
移轉報告 |
|||
</title><style> |
|||
/* Body style, for the entire document */ |
|||
body |
|||
{ |
|||
background: #F3F3F4; |
|||
color: #1E1E1F; |
|||
font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; |
|||
padding: 0; |
|||
margin: 0; |
|||
} |
|||
|
|||
/* Header1 style, used for the main title */ |
|||
h1 |
|||
{ |
|||
padding: 10px 0px 10px 10px; |
|||
font-size: 21pt; |
|||
background-color: #E2E2E2; |
|||
border-bottom: 1px #C1C1C2 solid; |
|||
color: #201F20; |
|||
margin: 0; |
|||
font-weight: normal; |
|||
} |
|||
|
|||
/* Header2 style, used for "Overview" and other sections */ |
|||
h2 |
|||
{ |
|||
font-size: 18pt; |
|||
font-weight: normal; |
|||
padding: 15px 0 5px 0; |
|||
margin: 0; |
|||
} |
|||
|
|||
/* Header3 style, used for sub-sections, such as project name */ |
|||
h3 |
|||
{ |
|||
font-weight: normal; |
|||
font-size: 15pt; |
|||
margin: 0; |
|||
padding: 15px 0 5px 0; |
|||
background-color: transparent; |
|||
} |
|||
|
|||
/* Color all hyperlinks one color */ |
|||
a |
|||
{ |
|||
color: #1382CE; |
|||
} |
|||
|
|||
/* Table styles */ |
|||
table |
|||
{ |
|||
border-spacing: 0 0; |
|||
border-collapse: collapse; |
|||
font-size: 10pt; |
|||
} |
|||
|
|||
table th |
|||
{ |
|||
background: #E7E7E8; |
|||
text-align: left; |
|||
text-decoration: none; |
|||
font-weight: normal; |
|||
padding: 3px 6px 3px 6px; |
|||
} |
|||
|
|||
table td |
|||
{ |
|||
vertical-align: top; |
|||
padding: 3px 6px 5px 5px; |
|||
margin: 0px; |
|||
border: 1px solid #E7E7E8; |
|||
background: #F7F7F8; |
|||
} |
|||
|
|||
/* Local link is a style for hyperlinks that link to file:/// content, there are lots so color them as 'normal' text until the user mouse overs */ |
|||
.localLink |
|||
{ |
|||
color: #1E1E1F; |
|||
background: #EEEEED; |
|||
text-decoration: none; |
|||
} |
|||
|
|||
.localLink:hover |
|||
{ |
|||
color: #1382CE; |
|||
background: #FFFF99; |
|||
text-decoration: none; |
|||
} |
|||
|
|||
/* Center text, used in the over views cells that contain message level counts */ |
|||
.textCentered |
|||
{ |
|||
text-align: center; |
|||
} |
|||
|
|||
/* The message cells in message tables should take up all avaliable space */ |
|||
.messageCell |
|||
{ |
|||
width: 100%; |
|||
} |
|||
|
|||
/* Padding around the content after the h1 */ |
|||
#content |
|||
{ |
|||
padding: 0px 12px 12px 12px; |
|||
} |
|||
|
|||
/* The overview table expands to width, with a max width of 97% */ |
|||
#overview table |
|||
{ |
|||
width: auto; |
|||
max-width: 75%; |
|||
} |
|||
|
|||
/* The messages tables are always 97% width */ |
|||
#messages table |
|||
{ |
|||
width: 97%; |
|||
} |
|||
|
|||
/* All Icons */ |
|||
.IconSuccessEncoded, .IconInfoEncoded, .IconWarningEncoded, .IconErrorEncoded |
|||
{ |
|||
min-width:18px; |
|||
min-height:18px; |
|||
background-repeat:no-repeat; |
|||
background-position:center; |
|||
} |
|||
|
|||
/* Success icon encoded */ |
|||
.IconSuccessEncoded |
|||
{ |
|||
/* Note: Do not delete the comment below. It is used to verify the correctness of the encoded image resource below before the product is released */ |
|||
/* [---XsltValidateInternal-Base64EncodedImage:IconSuccess#Begin#background-image: url(data:image/png;base64,#Separator#);#End#] */ |
|||
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAA7EAAAOxAGVKw4bAAABcElEQVR4Xq2TsUsCURzHv15g8ZJcBWlyiYYgCIWcb9DFRRwMW5TA2c0/QEFwFkxxUQdxVlBwCYWOi6IhWgQhBLHJUCkhLr/BW8S7gvrAg+N+v8/v+x68Z8MGy+XSCyABQAXgBgHGALoASkIIDWSLeLBetdHryMjd5IxQPWT4rn1c/P7+xxp72Cs9m5SZ0Bq2vPnbPFafK2zDvmNHypdC0BPkLlQhxJsCAhQoZwdZU5mwxh720qGo8MzTxTTKZDPCx2HoVzp6lz0Q9tKhyx0kGs8Ny+TkWRKk8lCROwEduhyg9l/6lunOPSfmH3NUH6uQ0KHLAe7JYvJjevm+DAMGJHToKtigE+vwvIidxLamb8IBY9e+C5LiXREkfho3TSd06HJA13/oh6T51MTsfQbHrsMynQ5dDihFjiK8JJAU9AKIWTp76dCVN7HWHrajmUEGvyF9nkbAE6gLIS7kTUyuf2gscLoJrElZo/Mvj+nPz/kLTmfnEwP3tB0AAAAASUVORK5CYII=); |
|||
} |
|||
|
|||
/* Information icon encoded */ |
|||
.IconInfoEncoded |
|||
{ |
|||
/* Note: Do not delete the comment below. It is used to verify the correctness of the encoded image resource below before the product is released */ |
|||
/* [---XsltValidateInternal-Base64EncodedImage:IconInformation#Begin#background-image: url(data:image/png;base64,#Separator#);#End#] */ |
|||
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAABHElEQVR4Xs2TsUoDQRRF7wwoziokjZUKadInhdhukR9YP8DMX1hYW+QvdsXa/QHBbcXC7W0CamWTQnclFutceIQJwwaWNLlwm5k5d94M76mmaeCrrmsLYOocY12FcxZFUeozCqKqqgYA8uevv1H6VuPxcwlfk5N92KHBxfFeCSAxxswlYAW/Xr989x/mv9gkhtyMDhcAxgzRsp7flj8B/HF1RsMXq+NZMkopaHe7lbKxQUEIGbKsYNoGn969060hZBkQex/W8oRQwsQaW2o3Ago2SVcJUzAgY3N0lTCZZm+zPS8HB51gMmS1DEYyOz9acKO1D8JWTlafKIMxdhvlfdyT94Vv5h7P8Ky7nQzACmhvKq3zk3PjW9asz9D/1oigecsioooAAAAASUVORK5CYII=); |
|||
} |
|||
|
|||
/* Warning icon encoded */ |
|||
.IconWarningEncoded |
|||
{ |
|||
/* Note: Do not delete the comment below. It is used to verify the correctness of the encoded image resource below before the product is released */ |
|||
/* [---XsltValidateInternal-Base64EncodedImage:IconWarning#Begin#background-image: url(data:image/png;base64,#Separator#);#End#] */ |
|||
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAx0lEQVR4XpWSMQ7CMAxFf4xAyBMLCxMrO8dhaBcuwdCJS3RJBw7SA/QGTCxdWJgiQYWKXJWKIXHIlyw5lqr34tQgEOdcBsCOx5yZK3hCCKdYXneQkh4pEfqzLfu+wVDSyyzFoJjfz9NB+pAF+eizx2Vruts0k15mPgvS6GYvpVtQhB61IB/dk6AF6fS4Ben0uIX5odtFe8Q/eW1KvFeH4e8khT6+gm5B+t3juyDt7n0jpe+CANTd+oTUjN/U3yVaABnSUjFz/gFq44JaVSCXeQAAAABJRU5ErkJggg==); |
|||
} |
|||
|
|||
/* Error icon encoded */ |
|||
.IconErrorEncoded |
|||
{ |
|||
/* Note: Do not delete the comment below. It is used to verify the correctness of the encoded image resource below before the product is released */ |
|||
/* [---XsltValidateInternal-Base64EncodedImage:IconError#Begin#background-image: url(data:image/png;base64,#Separator#);#End#] */ |
|||
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAABQElEQVR4XqWTvUoEQRCE6wYPZUA80AfwAQz23uCMjA7MDRQEIzPBVEyNTQUFIw00vcQTTMzuAh/AxEQQT8HF/3G/oGGnEUGuoNnd6qoZuqltyKEsyzVJq5I6rnUp6SjGeGhESikzzlc1eL7opfuVbrqbU1Zw9NCgtQMaZpY0eNnaaL2fHusvTK5vKu7sjSS1Y4y3QUA6K3e3Mau5UFDyMP7tYF9o8cAHZv68vipoIJg971PZIZ5HiwdvYGGvFVFHmGmZ2MxwmQYPXubPl9Up0tfoMQGetXd6mRbvhBw+boZ6WF7Mbv1+GsHRk0fQmPAH1GfmZirbCfDJ61tw3Px8/8pZsPAG4jlVhcPgZ7adwNWBB68lkRQWFiTgFlbnLY3DGGM7izIJIyT/jjIvEJw6fdJTc6krDzh6aMwMP9bvDH4ADSsa9uSWVJkAAAAASUVORK5CYII=); |
|||
} |
|||
</style><script type="text/javascript" language="javascript"> |
|||
|
|||
// Startup |
|||
// Hook up the the loaded event for the document/window, to linkify the document content |
|||
var startupFunction = function() { linkifyElement("messages"); }; |
|||
|
|||
if(window.attachEvent) |
|||
{ |
|||
window.attachEvent('onload', startupFunction); |
|||
} |
|||
else if (window.addEventListener) |
|||
{ |
|||
window.addEventListener('load', startupFunction, false); |
|||
} |
|||
else |
|||
{ |
|||
document.addEventListener('load', startupFunction, false); |
|||
} |
|||
|
|||
// Toggles the visibility of table rows with the specified name |
|||
function toggleTableRowsByName(name) |
|||
{ |
|||
var allRows = document.getElementsByTagName('tr'); |
|||
for (i=0; i < allRows.length; i++) |
|||
{ |
|||
var currentName = allRows[i].getAttribute('name'); |
|||
if(!!currentName && currentName.indexOf(name) == 0) |
|||
{ |
|||
var isVisible = allRows[i].style.display == ''; |
|||
isVisible ? allRows[i].style.display = 'none' : allRows[i].style.display = ''; |
|||
} |
|||
} |
|||
} |
|||
|
|||
function scrollToFirstVisibleRow(name) |
|||
{ |
|||
var allRows = document.getElementsByTagName('tr'); |
|||
for (i=0; i < allRows.length; i++) |
|||
{ |
|||
var currentName = allRows[i].getAttribute('name'); |
|||
var isVisible = allRows[i].style.display == ''; |
|||
if(!!currentName && currentName.indexOf(name) == 0 && isVisible) |
|||
{ |
|||
allRows[i].scrollIntoView(true); |
|||
return true; |
|||
} |
|||
} |
|||
|
|||
return false; |
|||
} |
|||
|
|||
// Linkifies the specified text content, replaces candidate links with html links |
|||
function linkify(text) |
|||
{ |
|||
if(!text || 0 === text.length) |
|||
{ |
|||
return text; |
|||
} |
|||
|
|||
// Find http, https and ftp links and replace them with hyper links |
|||
var urlLink = /(http|https|ftp)\:\/\/[a-zA-Z0-9\-\.]+(:[a-zA-Z0-9]*)?\/?([a-zA-Z0-9\-\._\?\,\/\\\+&%\$#\=~;\{\}])*/gi; |
|||
|
|||
return text.replace(urlLink, '<a href="$&">$&</a>') ; |
|||
} |
|||
|
|||
// Linkifies the specified element by ID |
|||
function linkifyElement(id) |
|||
{ |
|||
var element = document.getElementById(id); |
|||
if(!!element) |
|||
{ |
|||
element.innerHTML = linkify(element.innerHTML); |
|||
} |
|||
} |
|||
|
|||
function ToggleMessageVisibility(projectName) |
|||
{ |
|||
if(!projectName || 0 === projectName.length) |
|||
{ |
|||
return; |
|||
} |
|||
|
|||
toggleTableRowsByName("MessageRowClass" + projectName); |
|||
toggleTableRowsByName('MessageRowHeaderShow' + projectName); |
|||
toggleTableRowsByName('MessageRowHeaderHide' + projectName); |
|||
} |
|||
|
|||
function ScrollToFirstVisibleMessage(projectName) |
|||
{ |
|||
if(!projectName || 0 === projectName.length) |
|||
{ |
|||
return; |
|||
} |
|||
|
|||
// First try the 'Show messages' row |
|||
if(!scrollToFirstVisibleRow('MessageRowHeaderShow' + projectName)) |
|||
{ |
|||
// Failed to find a visible row for 'Show messages', try an actual message row |
|||
scrollToFirstVisibleRow('MessageRowClass' + projectName); |
|||
} |
|||
} |
|||
</script></head><body><h1 _locID="ConversionReport"> |
|||
移轉報告 - </h1><div id="content"><h2 _locID="OverviewTitle">概觀</h2><div id="overview"><table><tr><th></th><th _locID="ProjectTableHeader">專案</th><th _locID="PathTableHeader">路徑</th><th _locID="ErrorsTableHeader">錯誤</th><th _locID="WarningsTableHeader">警告</th><th _locID="MessagesTableHeader">訊息</th></tr><tr><td class="IconErrorEncoded" /><td><strong><a href="#ExportProject">ExportProject</a></strong></td><td>..\ExportProject\ExportProject.vdproj</td><td class="textCentered"><a href="#ExportProjectError">1</a></td><td class="textCentered"><a>0</a></td><td class="textCentered"><a href="#">0</a></td></tr><tr><td class="IconSuccessEncoded" /><td><strong><a href="#Solution"><span _locID="OverviewSolutionSpan">方案</span></a></strong></td><td>ExportDataToFile.sln</td><td class="textCentered"><a>0</a></td><td class="textCentered"><a>0</a></td><td class="textCentered"><a href="#" onclick="ScrollToFirstVisibleMessage('Solution'); return false;">1</a></td></tr></table></div><h2 _locID="SolutionAndProjectsTitle">方案和專案</h2><div id="messages"><a name="ExportProject" /><h3>ExportProject</h3><table><tr id="ExportProjectHeaderRow"><th></th><th class="messageCell" _locID="MessageTableHeader">訊息</th></tr><tr name="ErrorRowClassExportProject"><td class="IconErrorEncoded"><a name="ExportProjectError" /></td><td class="messageCell"><strong>..\ExportProject\ExportProject.vdproj: |
|||
</strong><span>找不到這種專案類型的基礎應用程式。請嘗試這個連結以取得其他資訊: 54435603-dbb4-11d2-8724-00a0c9a8b90c</span></td></tr></table><a name="Solution" /><h3 _locID="ProjectDisplayNameHeader">方案</h3><table><tr id="SolutionHeaderRow"><th></th><th class="messageCell" _locID="MessageTableHeader">訊息</th></tr><tr name="MessageRowHeaderShowSolution"><td class="IconInfoEncoded" /><td class="messageCell"><a _locID="ShowAdditionalMessages" href="#" name="SolutionMessage" onclick="ToggleMessageVisibility('Solution'); return false;"> |
|||
顯示 1 其他訊息 |
|||
</a></td></tr><tr name="MessageRowClassSolution" style="display: none"><td class="IconInfoEncoded"><a name="SolutionMessage" /></td><td class="messageCell"><strong>ExportDataToFile.sln: |
|||
</strong><span>這個方案檔不需要移轉。</span></td></tr><tr style="display: none" name="MessageRowHeaderHideSolution"><td class="IconInfoEncoded" /><td class="messageCell"><a _locID="HideAdditionalMessages" href="#" name="SolutionMessage" onclick="ToggleMessageVisibility('Solution'); return false;"> |
|||
隱藏 1 其他訊息 |
|||
</a></td></tr></table></div></div></body></html> |
@ -0,0 +1,206 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
using System.IO; |
|||
using System.Data; |
|||
using System.Data.Sql; |
|||
using System.Data.SqlClient; |
|||
using System.Configuration; |
|||
using MySqlConnector; |
|||
|
|||
|
|||
|
|||
namespace ManagementSystem.Utility |
|||
{ |
|||
public static class MySQLUtility |
|||
{ |
|||
|
|||
#region 取得指定Table資料
|
|||
public static DataTable GetTable(string strTableName, int intTopCount, string[] strColumnList , string strWhere, string strOrderBy, MySqlConnection sqlConn) |
|||
{ |
|||
DataSet dsData = new DataSet(); |
|||
string strCommand = ""; |
|||
try |
|||
{ |
|||
string strColumns = ""; |
|||
foreach (string strColumn in strColumnList) //取得欄位陣列
|
|||
{ |
|||
if (strColumns != "") |
|||
{ |
|||
strColumns += "," + strColumn.Trim(); |
|||
} |
|||
else |
|||
{ |
|||
strColumns = strColumn; |
|||
} |
|||
} |
|||
|
|||
if (intTopCount > 0) |
|||
{ |
|||
strCommand = string.Format("Select {1} From {2} Limit {0}", intTopCount.ToString(), strColumns, strTableName); |
|||
} |
|||
else |
|||
{ |
|||
strCommand = string.Format("Select {0} From {1} ", strColumns, strTableName); |
|||
} |
|||
|
|||
if (strWhere != "") //設定過濾條件
|
|||
{ |
|||
strCommand += " Where " + strWhere; |
|||
} |
|||
|
|||
if (strOrderBy != "") //取得排序欄位
|
|||
{ |
|||
strCommand += " Order By " + strOrderBy; |
|||
} |
|||
|
|||
using (MySqlDataAdapter sqlAdapter = new MySqlDataAdapter(strCommand, sqlConn)) |
|||
{ |
|||
if (sqlConn.State == ConnectionState.Closed) //判斷連線狀態
|
|||
{ |
|||
sqlConn.Open(); |
|||
} |
|||
sqlAdapter.Fill(dsData, "Result"); |
|||
} |
|||
|
|||
if (dsData.Tables.Count != 0) |
|||
{ |
|||
return dsData.Tables["Result"]; |
|||
} |
|||
else |
|||
{ |
|||
return null; |
|||
} |
|||
} |
|||
catch (Exception ex) |
|||
{ |
|||
return null; |
|||
throw ex; |
|||
} |
|||
} |
|||
|
|||
public static DataTable GetTable(string strTableName, int intTopCount, string[] strColumnList, string strWhere, MySqlConnection sqlConn) |
|||
{ |
|||
return GetTable(strTableName, intTopCount, strColumnList, strWhere, "", sqlConn); |
|||
} |
|||
|
|||
public static DataTable GetTable(string strTableName, int intTopCount, string[] strColumnList, MySqlConnection sqlConn) |
|||
{ |
|||
return GetTable(strTableName, intTopCount, strColumnList,"","", sqlConn); |
|||
} |
|||
|
|||
public static DataTable GetTable(string strTableName, int intTopCount, MySqlConnection sqlConn) |
|||
{ |
|||
return GetTable(strTableName, intTopCount,new string[] {"*"}, "", "", sqlConn); |
|||
} |
|||
|
|||
public static DataTable GetTable(string strTableName, MySqlConnection sqlConn) |
|||
{ |
|||
return GetTable(strTableName, 0, new string[] { "*" }, "", "", sqlConn); |
|||
} |
|||
|
|||
|
|||
#endregion
|
|||
|
|||
#region MyQL命令相關程式集
|
|||
public static MySqlConnection GetConn(string strIP, string strDBName, string strID, string strPWD, string strPort) |
|||
{ |
|||
try |
|||
{ |
|||
string strConnectionString = "server=" + strIP + ";port=" + strPort + ";database=" + strDBName + ";user id=" + strID + ";password=" + strPWD + ";charset=utf8;"; |
|||
MySqlConnection sqlConn = new MySqlConnection(strConnectionString); |
|||
sqlConn.ConnectionString = strConnectionString; |
|||
sqlConn.Open(); |
|||
return sqlConn; |
|||
} |
|||
catch (Exception ex) |
|||
{ |
|||
ErrorHandler.WriteErrorLog("MySQLUtilityClass.cs", ex); |
|||
return null; |
|||
} |
|||
} |
|||
|
|||
public static DataTable GetSQLResult(string strSQL, MySqlConnection sqlConn) |
|||
{ |
|||
DataSet dsData = new DataSet(); |
|||
try |
|||
{ |
|||
using (MySqlDataAdapter sqlAdapter = new MySqlDataAdapter(strSQL, sqlConn)) |
|||
{ |
|||
if (sqlConn == null) |
|||
return null; |
|||
if (sqlConn.State == ConnectionState.Closed) //判斷連線狀態
|
|||
{ |
|||
sqlConn.Open(); |
|||
} |
|||
sqlAdapter.Fill(dsData, "Result"); |
|||
} |
|||
|
|||
if (dsData.Tables.Count != 0) |
|||
{ |
|||
return dsData.Tables["Result"]; |
|||
} |
|||
else |
|||
{ |
|||
return null; |
|||
} |
|||
} |
|||
catch(Exception ex) |
|||
{ |
|||
return null; |
|||
throw ex; |
|||
} |
|||
} |
|||
|
|||
public static bool IsExist(string strSQL, MySqlConnection sqlConn) |
|||
{ |
|||
try |
|||
{ |
|||
DataTable dtResult = GetSQLResult(strSQL, sqlConn); |
|||
if (dtResult.Rows.Count > 0) |
|||
{ return true; } |
|||
else |
|||
{ return false; } |
|||
} |
|||
catch (Exception ex) |
|||
{ |
|||
throw ex; |
|||
} |
|||
} |
|||
|
|||
public static bool RunSQLNonReturn(string strSQL, MySqlConnection sqlConn) |
|||
{ |
|||
try |
|||
{ |
|||
MySqlCommand sqlCmd = new MySqlCommand(strSQL, sqlConn); |
|||
if (sqlConn.State == ConnectionState.Closed) //判斷連線狀態
|
|||
{ |
|||
sqlConn.Open(); |
|||
} |
|||
sqlCmd.ExecuteNonQuery(); |
|||
return true; |
|||
} |
|||
catch (Exception ex) |
|||
{ |
|||
return false; |
|||
} |
|||
} |
|||
|
|||
public static string GetSQLCount(string strSQL, MySqlConnection sqlConn) |
|||
{ |
|||
string strCount = ""; |
|||
DataTable dtTemp = GetSQLResult(strSQL, sqlConn); |
|||
strCount = dtTemp.Rows.Count.ToString(); |
|||
|
|||
//回傳查詢結果
|
|||
if(strCount == "") |
|||
{ return "0"; } |
|||
else |
|||
{ return strCount; } |
|||
} |
|||
#endregion
|
|||
|
|||
} |
|||
} |
@ -0,0 +1,207 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
using System.IO; |
|||
using System.Data; |
|||
using System.Data.Sql; |
|||
using System.Data.SqlClient; |
|||
using System.Configuration; |
|||
using Oracle.ManagedDataAccess.Client; |
|||
|
|||
|
|||
|
|||
namespace ManagementSystem.Utility |
|||
{ |
|||
public static class OracleUtility |
|||
{ |
|||
|
|||
#region 取得指定Table資料
|
|||
public static DataTable GetTable(string strTableName,int intTopCount, string[] strColumnList , string strWhere, string strOrderBy, OracleConnection sqlConn) |
|||
{ |
|||
DataSet dsData = new DataSet(); |
|||
string strCommand = ""; |
|||
try |
|||
{ |
|||
string strColumns = ""; |
|||
foreach (string strColumn in strColumnList) //取得欄位陣列
|
|||
{ |
|||
if (strColumns != "") |
|||
{ |
|||
strColumns += "," + strColumn.Trim(); |
|||
} |
|||
else |
|||
{ |
|||
strColumns = strColumn; |
|||
} |
|||
} |
|||
|
|||
if (intTopCount > 0) |
|||
{ |
|||
strCommand = string.Format("Select {1} From {2} FETCH FIRST {0} ROWS ONLY", intTopCount.ToString(), strColumns, strTableName); |
|||
} |
|||
else |
|||
{ |
|||
strCommand = string.Format("Select {0} From {1} ", strColumns, strTableName); |
|||
} |
|||
|
|||
if (strWhere != "") //設定過濾條件
|
|||
{ |
|||
strCommand += " Where " + strWhere; |
|||
} |
|||
|
|||
if (strOrderBy != "") //取得排序欄位
|
|||
{ |
|||
strCommand += " Order By " + strOrderBy; |
|||
} |
|||
|
|||
using (OracleDataAdapter sqlAdapter = new OracleDataAdapter(strCommand, sqlConn)) |
|||
{ |
|||
if (sqlConn.State == ConnectionState.Closed) //判斷連線狀態
|
|||
{ |
|||
sqlConn.Open(); |
|||
} |
|||
sqlAdapter.Fill(dsData, "Result"); |
|||
} |
|||
|
|||
if (dsData.Tables.Count != 0) |
|||
{ |
|||
return dsData.Tables["Result"]; |
|||
} |
|||
else |
|||
{ |
|||
return null; |
|||
} |
|||
} |
|||
catch (Exception ex) |
|||
{ |
|||
return null; |
|||
throw ex; |
|||
} |
|||
} |
|||
|
|||
public static DataTable GetTable(string strTableName, int intTopCount, string[] strColumnList, string strWhere, OracleConnection sqlConn) |
|||
{ |
|||
return GetTable(strTableName, intTopCount ,strColumnList, strWhere, "", sqlConn); |
|||
} |
|||
|
|||
public static DataTable GetTable(string strTableName,int intTopCount, string[] strColumnList, OracleConnection sqlConn) |
|||
{ |
|||
return GetTable(strTableName, intTopCount, strColumnList,"","", sqlConn); |
|||
} |
|||
|
|||
public static DataTable GetTable(string strTableName,int intTopCount, OracleConnection sqlConn) |
|||
{ |
|||
return GetTable(strTableName, intTopCount, new string[] {"*"}, "", "", sqlConn); |
|||
} |
|||
|
|||
public static DataTable GetTable(string strTableName, OracleConnection sqlConn) |
|||
{ |
|||
return GetTable(strTableName, 0, new string[] { "*" }, "", "", sqlConn); |
|||
} |
|||
|
|||
#endregion
|
|||
|
|||
#region Oracle命令相關程式集
|
|||
public static OracleConnection GetConn(string strIP, string strDBName, string strID, string strPWD, string strPort) |
|||
{ |
|||
try |
|||
{ |
|||
string strConnectionString = "Data Source = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = " + strIP + ")(PORT = " + strPort + ")))(CONNECT_DATA = (SERVER = DEDICATED)(SERVICE_NAME = " + strDBName + "))); User Id = " + strID + "; Password = " + strPWD + ";"; |
|||
OracleConnection sqlConn = new OracleConnection(strConnectionString); |
|||
sqlConn.ConnectionString = strConnectionString; |
|||
sqlConn.Open(); |
|||
return sqlConn; |
|||
} |
|||
catch (Exception ex) |
|||
{ |
|||
ErrorHandler.WriteErrorLog("OracleSQLUtilityClass.GetConn", ex); |
|||
return null; |
|||
} |
|||
} |
|||
|
|||
public static DataTable GetSQLResult(string strSQL, OracleConnection sqlConn) |
|||
{ |
|||
DataSet dsData = new DataSet(); |
|||
try |
|||
{ |
|||
using (OracleDataAdapter sqlAdapter = new OracleDataAdapter(strSQL, sqlConn)) |
|||
{ |
|||
if (sqlConn == null) |
|||
return null; |
|||
if (sqlConn.State == ConnectionState.Closed) //判斷連線狀態
|
|||
{ |
|||
sqlConn.Open(); |
|||
} |
|||
|
|||
sqlAdapter.Fill(dsData, "Result"); |
|||
} |
|||
|
|||
if (dsData.Tables.Count != 0) |
|||
{ |
|||
return dsData.Tables["Result"]; |
|||
} |
|||
else |
|||
{ |
|||
return null; |
|||
} |
|||
} |
|||
catch(Exception ex) |
|||
{ |
|||
ErrorHandler.WriteErrorLog("OracleSQLUtilityClass.GetSQLResult", ex); |
|||
throw ex; |
|||
} |
|||
} |
|||
|
|||
public static bool IsExist(string strSQL, OracleConnection sqlConn) |
|||
{ |
|||
try |
|||
{ |
|||
DataTable dtResult = GetSQLResult(strSQL, sqlConn); |
|||
if (dtResult.Rows.Count > 0) |
|||
{ return true; } |
|||
else |
|||
{ return false; } |
|||
} |
|||
catch (Exception ex) |
|||
{ |
|||
throw ex; |
|||
} |
|||
} |
|||
|
|||
public static bool RunSQLNonReturn(string strSQL, OracleConnection sqlConn) |
|||
{ |
|||
try |
|||
{ |
|||
OracleCommand sqlCmd = new OracleCommand(strSQL, sqlConn); |
|||
if (sqlConn.State == ConnectionState.Closed) //判斷連線狀態
|
|||
{ |
|||
sqlConn.Open(); |
|||
} |
|||
sqlCmd.ExecuteNonQuery(); |
|||
return true; |
|||
} |
|||
catch (Exception ex) |
|||
{ |
|||
ErrorHandler.WriteErrorLog("OracleSQLUtilityClass.RunSQLNonReturn", ex); |
|||
return false; |
|||
} |
|||
} |
|||
|
|||
public static string GetSQLCount(string strSQL, OracleConnection sqlConn) |
|||
{ |
|||
string strCount = ""; |
|||
DataTable dtTemp = GetSQLResult(strSQL, sqlConn); |
|||
strCount = dtTemp.Rows.Count.ToString(); |
|||
|
|||
//回傳查詢結果
|
|||
if(strCount == "") |
|||
{ return "0"; } |
|||
else |
|||
{ return strCount; } |
|||
} |
|||
#endregion
|
|||
|
|||
} |
|||
} |
@ -0,0 +1,204 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
using System.IO; |
|||
using System.Data; |
|||
//using System.Data.Sql;
|
|||
//using System.Data.SqlClient;
|
|||
using System.Configuration; |
|||
using Npgsql; |
|||
|
|||
|
|||
namespace ManagementSystem.Utility |
|||
{ |
|||
public static class PostgreSQLUtility |
|||
{ |
|||
#region 取得指定Table資料
|
|||
public static DataTable GetTable(string strTableName, int intTopCount, string[] strColumnList, string strWhere, string strOrderBy, NpgsqlConnection sqlConn) |
|||
{ |
|||
DataSet dsData = new DataSet(); |
|||
try |
|||
{ |
|||
string strColumns = ""; |
|||
string strCommand = ""; |
|||
foreach (string strColumn in strColumnList) //取得欄位陣列
|
|||
{ |
|||
if (strColumns != "") |
|||
{ |
|||
strColumns += "," + strColumn.Trim(); |
|||
} |
|||
else |
|||
{ |
|||
strColumns = strColumn; |
|||
} |
|||
} |
|||
|
|||
if (intTopCount > 0) |
|||
{ |
|||
strCommand = string.Format("Select {1} From \"{2}\" LIMIT {0}", intTopCount.ToString(), strColumns, strTableName); |
|||
} |
|||
else |
|||
{ |
|||
strCommand = string.Format("Select {0} From \"{1}\" ", strColumns, strTableName); |
|||
} |
|||
|
|||
if (strWhere != "") //設定過濾條件
|
|||
{ |
|||
strCommand += " Where " + strWhere; |
|||
} |
|||
|
|||
if (strOrderBy != "") //取得排序欄位
|
|||
{ |
|||
strCommand += " Order By " + strOrderBy; |
|||
} |
|||
|
|||
using (NpgsqlDataAdapter sqlAdapter = new NpgsqlDataAdapter(strCommand, sqlConn)) |
|||
{ |
|||
if (sqlConn.State == ConnectionState.Closed) //判斷連線狀態
|
|||
{ |
|||
sqlConn.Open(); |
|||
} |
|||
sqlAdapter.Fill(dsData, "Result"); |
|||
} |
|||
|
|||
if (dsData.Tables.Count != 0) |
|||
{ |
|||
return dsData.Tables["Result"]; |
|||
} |
|||
else |
|||
{ |
|||
return null; |
|||
} |
|||
} |
|||
catch (Exception ex) |
|||
{ |
|||
return null; |
|||
throw ex; |
|||
} |
|||
} |
|||
|
|||
public static DataTable GetTable(string strTableName, int intTopCount, string[] strColumnList, string strWhere, NpgsqlConnection sqlConn) |
|||
{ |
|||
return GetTable(strTableName, intTopCount, strColumnList, strWhere, "", sqlConn); |
|||
} |
|||
|
|||
public static DataTable GetTable(string strTableName, int intTopCount, string[] strColumnList, NpgsqlConnection sqlConn) |
|||
{ |
|||
return GetTable(strTableName, intTopCount, strColumnList, "", "", sqlConn); |
|||
} |
|||
|
|||
public static DataTable GetTable(string strTableName, int intTopCount, NpgsqlConnection sqlConn) |
|||
{ |
|||
return GetTable(strTableName, intTopCount, new string[] { "*" }, "", "", sqlConn); |
|||
} |
|||
|
|||
public static DataTable GetTable(string strTableName, NpgsqlConnection sqlConn) |
|||
{ |
|||
return GetTable(strTableName, 0, new string[] { "*" }, "", "", sqlConn); |
|||
} |
|||
|
|||
#endregion
|
|||
|
|||
#region MS-SQL命令相關程式集
|
|||
public static NpgsqlConnection GetConn(string strIP, string strDBName, string strID, string strPWD, string strPort) |
|||
{ |
|||
try |
|||
{ |
|||
string strConnectionString = "Host=" + strIP + ";Port="+ strPort + ";Database=" + strDBName + ";Username=" + strID + ";Password=" + strPWD; |
|||
NpgsqlConnection sqlConn = new NpgsqlConnection(strConnectionString); |
|||
sqlConn.ConnectionString = strConnectionString; |
|||
sqlConn.Open(); |
|||
return sqlConn; |
|||
} |
|||
catch (Exception ex) |
|||
{ |
|||
ErrorHandler.WriteErrorLog("PostgreSQLUtilityClass.cs", ex); |
|||
return null; |
|||
} |
|||
} |
|||
|
|||
public static DataTable GetSQLResult(string strSQL, NpgsqlConnection sqlConn) |
|||
{ |
|||
DataSet dsData = new DataSet(); |
|||
try |
|||
{ |
|||
|
|||
using (NpgsqlDataAdapter sqlAdapter = new NpgsqlDataAdapter(strSQL, sqlConn)) |
|||
{ |
|||
if (sqlConn == null) |
|||
return null; |
|||
if (sqlConn.State == ConnectionState.Closed) //判斷連線狀態
|
|||
{ |
|||
sqlConn.Open(); |
|||
} |
|||
sqlAdapter.Fill(dsData, "Result"); |
|||
} |
|||
if (dsData.Tables.Count != 0) |
|||
{ |
|||
return dsData.Tables["Result"]; |
|||
} |
|||
else |
|||
{ |
|||
return null; |
|||
} |
|||
} |
|||
catch (Exception ex) |
|||
{ |
|||
return null; |
|||
throw ex; |
|||
} |
|||
} |
|||
|
|||
public static bool IsExist(string strSQL, NpgsqlConnection sqlConn) |
|||
{ |
|||
try |
|||
{ |
|||
DataTable dtResult = GetSQLResult(strSQL, sqlConn); |
|||
if (dtResult.Rows.Count > 0) |
|||
{ return true; } |
|||
else |
|||
{ return false; } |
|||
} |
|||
catch (Exception ex) |
|||
{ |
|||
throw ex; |
|||
} |
|||
} |
|||
|
|||
public static bool RunSQLNonReturn(string strSQL, NpgsqlConnection sqlConn) |
|||
{ |
|||
try |
|||
{ |
|||
NpgsqlCommand sqlCmd = new NpgsqlCommand(strSQL, sqlConn); |
|||
if (sqlConn.State == ConnectionState.Closed) //判斷連線狀態
|
|||
{ |
|||
sqlConn.Open(); |
|||
} |
|||
sqlCmd.ExecuteNonQuery(); |
|||
return true; |
|||
} |
|||
catch (Exception ex) |
|||
{ |
|||
return false; |
|||
} |
|||
} |
|||
|
|||
public static string GetSQLCount(string strSQL, NpgsqlConnection sqlConn) |
|||
{ |
|||
string strCount = ""; |
|||
DataTable dtTemp = GetSQLResult(strSQL, sqlConn); |
|||
strCount = dtTemp.Rows.Count.ToString(); |
|||
|
|||
//回傳查詢結果
|
|||
if (strCount == "") |
|||
{ return "0"; } |
|||
else |
|||
{ return strCount; } |
|||
} |
|||
|
|||
#endregion
|
|||
|
|||
} |
|||
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue