sql data adapter

main
syneffort 3 years ago
parent 05a4daa300
commit 94d89be43d
  1. 81
      MainApp/MainApp/AdoClient.cs
  2. 62
      MainApp/MainApp/Controls/Insert_Select_Control.Designer.cs
  3. 63
      MainApp/MainApp/Controls/Insert_Select_Control.cs
  4. 120
      MainApp/MainApp/Controls/Insert_Select_Control.resx
  5. 142
      MainApp/MainApp/Controls/Paging_Control.Designer.cs
  6. 71
      MainApp/MainApp/Controls/Paging_Control.cs
  7. 120
      MainApp/MainApp/Controls/Paging_Control.resx
  8. 19
      MainApp/MainApp/MainApp.csproj
  9. 16
      MainApp/MainApp/MainForm.Designer.cs
  10. 22
      MainApp/MainApp/MainForm.cs

@ -0,0 +1,81 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Diagnostics;
using System.Linq;
using System.Text;
namespace MainApp
{
class AdoClient
{
public static AdoClient Instance { get; } = new AdoClient();
private string connString;
private SqlConnection conn;
public bool SetConnection(string server, string database, string uid, string password)
{
connString = $"server={server}; database={database}; uid={uid}; pwd={password};";
using (conn = new SqlConnection(connString))
{
try
{
conn.Open();
conn.Close();
}
catch (Exception ex)
{
Debug.WriteLine(ex.Message);
return false;
}
}
return true;
}
public DataSet Query(string sql)
{
using (conn = new SqlConnection(connString))
{
conn.Open();
SqlDataAdapter adapter = new SqlDataAdapter(sql, conn);
DataSet dataSet = new DataSet();
adapter.Fill(dataSet);
conn.Close();
return dataSet;
}
}
public DataSet Query(string sql, int pageStart, int pageSize, string tableName)
{
using (conn = new SqlConnection(connString))
{
conn.Open();
SqlDataAdapter adapter = new SqlDataAdapter(sql, conn);
DataSet dataSet = new DataSet();
adapter.Fill(dataSet, pageStart, pageSize, tableName);
conn.Close();
return dataSet;
}
}
public int NonQuery(string sql)
{
using (conn = new SqlConnection(connString))
{
conn.Open();
SqlCommand cmd = new SqlCommand(sql, conn);
return cmd.ExecuteNonQuery();
}
}
}
}

@ -0,0 +1,62 @@

namespace MainApp.Controls
{
partial class Insert_Select_Control
{
/// <summary>
/// 필수 디자이너 변수입니다.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 사용 중인 모든 리소스를 정리합니다.
/// </summary>
/// <param name="disposing">관리되는 리소스를 삭제해야 하면 true이고, 그렇지 않으면 false입니다.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region 구성 요소 디자이너에서 생성한 코드
/// <summary>
/// 디자이너 지원에 필요한 메서드입니다.
/// 이 메서드의 내용을 코드 편집기로 수정하지 마세요.
/// </summary>
private void InitializeComponent()
{
this.mainGridView = new System.Windows.Forms.DataGridView();
((System.ComponentModel.ISupportInitialize)(this.mainGridView)).BeginInit();
this.SuspendLayout();
//
// mainGridView
//
this.mainGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.mainGridView.Dock = System.Windows.Forms.DockStyle.Fill;
this.mainGridView.Location = new System.Drawing.Point(0, 0);
this.mainGridView.Name = "mainGridView";
this.mainGridView.RowTemplate.Height = 23;
this.mainGridView.Size = new System.Drawing.Size(267, 316);
this.mainGridView.TabIndex = 1;
//
// Insert_Select_Control
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.mainGridView);
this.Name = "Insert_Select_Control";
this.Size = new System.Drawing.Size(267, 316);
((System.ComponentModel.ISupportInitialize)(this.mainGridView)).EndInit();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.DataGridView mainGridView;
}
}

@ -0,0 +1,63 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace MainApp.Controls
{
public partial class Insert_Select_Control : UserControl
{
private Timer _timer;
private int _idx;
private Random _rnd;
public Insert_Select_Control(int startIdx)
{
InitializeComponent();
InitInstance(startIdx);
}
private void InitInstance(int startIdx)
{
if (!AdoClient.Instance.SetConnection("peacecloud.synology.me,21433", "Study", "study", "Study123$"))
{
MessageBox.Show("Cannot access database.");
return;
}
_idx = startIdx;
_rnd = new Random();
_timer = new Timer();
_timer.Interval = 5 * 1000;
_timer.Tick += timer_Tick;
timer_Tick(null, null);
_timer.Start();
}
private void BindTableToGridView(DataTable table)
{
mainGridView.SuspendLayout();
mainGridView.DataSource = table;
mainGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;
mainGridView.ResumeLayout();
}
private void DoWork()
{
AdoClient.Instance.NonQuery($"INSERT INTO EMPLOYEE (ENO, ENAME, JOB, HIREDATE) VALUES ({_idx++}, 'e{_rnd.Next(1, 1000)}', 'tester', '{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}')");
DataSet dataSet = AdoClient.Instance.Query("SELECT * FROM EMPLOYEE");
BindTableToGridView(dataSet.Tables[0]);
}
private void timer_Tick(object sender, EventArgs e)
{
DoWork();
}
}
}

@ -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,142 @@

namespace MainApp.Controls
{
partial class Paging_Control
{
/// <summary>
/// 필수 디자이너 변수입니다.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 사용 중인 모든 리소스를 정리합니다.
/// </summary>
/// <param name="disposing">관리되는 리소스를 삭제해야 하면 true이고, 그렇지 않으면 false입니다.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region 구성 요소 디자이너에서 생성한 코드
/// <summary>
/// 디자이너 지원에 필요한 메서드입니다.
/// 이 메서드의 내용을 코드 편집기로 수정하지 마세요.
/// </summary>
private void InitializeComponent()
{
this.mainGridView = new System.Windows.Forms.DataGridView();
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel();
this.prevButton = new System.Windows.Forms.Button();
this.nextButton = new System.Windows.Forms.Button();
this.pageLabel = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.mainGridView)).BeginInit();
this.tableLayoutPanel1.SuspendLayout();
this.tableLayoutPanel2.SuspendLayout();
this.SuspendLayout();
//
// mainGridView
//
this.mainGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.mainGridView.Dock = System.Windows.Forms.DockStyle.Fill;
this.mainGridView.Location = new System.Drawing.Point(3, 3);
this.mainGridView.Name = "mainGridView";
this.mainGridView.RowTemplate.Height = 23;
this.mainGridView.Size = new System.Drawing.Size(383, 438);
this.mainGridView.TabIndex = 2;
//
// tableLayoutPanel1
//
this.tableLayoutPanel1.ColumnCount = 1;
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel1.Controls.Add(this.mainGridView, 0, 0);
this.tableLayoutPanel1.Controls.Add(this.tableLayoutPanel2, 0, 1);
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0);
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
this.tableLayoutPanel1.RowCount = 2;
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 35F));
this.tableLayoutPanel1.Size = new System.Drawing.Size(389, 479);
this.tableLayoutPanel1.TabIndex = 3;
//
// tableLayoutPanel2
//
this.tableLayoutPanel2.ColumnCount = 3;
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 100F));
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 100F));
this.tableLayoutPanel2.Controls.Add(this.prevButton, 1, 0);
this.tableLayoutPanel2.Controls.Add(this.nextButton, 2, 0);
this.tableLayoutPanel2.Controls.Add(this.pageLabel, 0, 0);
this.tableLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel2.Location = new System.Drawing.Point(3, 447);
this.tableLayoutPanel2.Name = "tableLayoutPanel2";
this.tableLayoutPanel2.RowCount = 1;
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel2.Size = new System.Drawing.Size(383, 29);
this.tableLayoutPanel2.TabIndex = 3;
//
// prevButton
//
this.prevButton.Dock = System.Windows.Forms.DockStyle.Fill;
this.prevButton.Location = new System.Drawing.Point(186, 3);
this.prevButton.Name = "prevButton";
this.prevButton.Size = new System.Drawing.Size(94, 23);
this.prevButton.TabIndex = 0;
this.prevButton.Text = "< Prev";
this.prevButton.UseVisualStyleBackColor = true;
this.prevButton.Click += new System.EventHandler(this.prevButton_Click);
//
// nextButton
//
this.nextButton.Dock = System.Windows.Forms.DockStyle.Fill;
this.nextButton.Location = new System.Drawing.Point(286, 3);
this.nextButton.Name = "nextButton";
this.nextButton.Size = new System.Drawing.Size(94, 23);
this.nextButton.TabIndex = 0;
this.nextButton.Text = "Next >";
this.nextButton.UseVisualStyleBackColor = true;
this.nextButton.Click += new System.EventHandler(this.nextButton_Click);
//
// pageLabel
//
this.pageLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.pageLabel.AutoSize = true;
this.pageLabel.Location = new System.Drawing.Point(3, 17);
this.pageLabel.Name = "pageLabel";
this.pageLabel.Size = new System.Drawing.Size(11, 12);
this.pageLabel.TabIndex = 1;
this.pageLabel.Text = "0";
this.pageLabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// Paging_Control
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.tableLayoutPanel1);
this.Name = "Paging_Control";
this.Size = new System.Drawing.Size(389, 479);
((System.ComponentModel.ISupportInitialize)(this.mainGridView)).EndInit();
this.tableLayoutPanel1.ResumeLayout(false);
this.tableLayoutPanel2.ResumeLayout(false);
this.tableLayoutPanel2.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.DataGridView mainGridView;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2;
private System.Windows.Forms.Button prevButton;
private System.Windows.Forms.Button nextButton;
private System.Windows.Forms.Label pageLabel;
}
}

@ -0,0 +1,71 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace MainApp.Controls
{
public partial class Paging_Control : UserControl
{
const int PAGE_SIZE = 10;
int _pageStartIdx = 0;
string _tableName = "Employees";
public Paging_Control()
{
InitializeComponent();
InitInstance();
}
private void InitInstance()
{
if (!AdoClient.Instance.SetConnection("peacecloud.synology.me,21433", "Study", "study", "Study123$"))
{
MessageBox.Show("Cannot access database.");
return;
}
DoWork(0);
}
private void BindTableToGridView(DataSet dataSet)
{
mainGridView.SuspendLayout();
mainGridView.DataSource = dataSet;
mainGridView.DataMember = _tableName;
mainGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;
mainGridView.ResumeLayout();
}
private void DoWork(int pageStart = 0, int pageSize = PAGE_SIZE)
{
BindTableToGridView(GetData(pageStart, pageSize));
pageLabel.Text = $"- {_pageStartIdx / PAGE_SIZE + 1} -";
}
private DataSet GetData(int pageStart = 0, int pageSize = PAGE_SIZE)
{
return AdoClient.Instance.Query("SELECT * FROM EMPLOYEE", pageStart, pageSize, _tableName);
}
private void prevButton_Click(object sender, EventArgs e)
{
if (_pageStartIdx - PAGE_SIZE < 0)
return;
_pageStartIdx -= PAGE_SIZE;
DoWork(_pageStartIdx);
}
private void nextButton_Click(object sender, EventArgs e)
{
_pageStartIdx += PAGE_SIZE;
DoWork(_pageStartIdx);
}
}
}

@ -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>

@ -44,7 +44,20 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="AdoClient.cs" />
<Compile Include="Client.cs" />
<Compile Include="Controls\Insert_Select_Control.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Controls\Insert_Select_Control.Designer.cs">
<DependentUpon>Insert_Select_Control.cs</DependentUpon>
</Compile>
<Compile Include="Controls\Paging_Control.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Controls\Paging_Control.Designer.cs">
<DependentUpon>Paging_Control.cs</DependentUpon>
</Compile>
<Compile Include="MainForm.cs">
<SubType>Form</SubType>
</Compile>
@ -53,6 +66,12 @@
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="Controls\Insert_Select_Control.resx">
<DependentUpon>Insert_Select_Control.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Controls\Paging_Control.resx">
<DependentUpon>Paging_Control.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="MainForm.resx">
<DependentUpon>MainForm.cs</DependentUpon>
</EmbeddedResource>

@ -29,36 +29,20 @@ namespace MainApp
/// </summary>
private void InitializeComponent()
{
this.mainGridView = new System.Windows.Forms.DataGridView();
((System.ComponentModel.ISupportInitialize)(this.mainGridView)).BeginInit();
this.SuspendLayout();
//
// mainGridView
//
this.mainGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.mainGridView.Dock = System.Windows.Forms.DockStyle.Fill;
this.mainGridView.Location = new System.Drawing.Point(0, 0);
this.mainGridView.Name = "mainGridView";
this.mainGridView.RowTemplate.Height = 23;
this.mainGridView.Size = new System.Drawing.Size(521, 500);
this.mainGridView.TabIndex = 0;
//
// MainForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(521, 500);
this.Controls.Add(this.mainGridView);
this.Name = "MainForm";
this.Text = "Form1";
((System.ComponentModel.ISupportInitialize)(this.mainGridView)).EndInit();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.DataGridView mainGridView;
}
}

@ -1,7 +1,9 @@
using System;
using MainApp.Controls;
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;
@ -11,6 +13,8 @@ namespace MainApp
{
public partial class MainForm : Form
{
public MainForm()
{
InitializeComponent();
@ -24,15 +28,15 @@ namespace MainApp
//Client.Handling();
BindTableToGridView();
}
//BindTableToGridView(Client.GetSampleTable());
private void BindTableToGridView()
{
mainGridView.SuspendLayout();
mainGridView.DataSource = Client.GetSampleTable();
mainGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;
mainGridView.ResumeLayout();
//Insert_Select_Control control = new Insert_Select_Control(900);
//control.Dock = DockStyle.Fill;
//this.Controls.Add(control);
Paging_Control control = new Paging_Control();
control.Dock = DockStyle.Fill;
this.Controls.Add(control);
}
}
}

Loading…
Cancel
Save