Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
SimpleDataBinding.cs
Package: CSharpprogramming.rar [view]
Upload User: lxycoco
Upload Date: 2022-07-21
Package Size: 38457k
Code Size: 2k
Category:
CSharp
Development Platform:
Others
- using System;
- using System.Windows.Forms;
- using System.Data;
- using System.Data.SqlClient;
- public class SimpleDataBinding : System.Windows.Forms.Form
- {
- private System.Windows.Forms.TextBox textbox ;
- /// <summary>
- /// Construct the window.
- /// </summary>
- /// <remarks>
- /// This method constructs the window by creating both the data grid and the button.
- /// </remarks>
- public SimpleDataBinding ( )
- {
- this.AutoScaleBaseSize = new System.Drawing.Size (5, 13);
- this.ClientSize = new System.Drawing.Size (464, 253);
- this.Text = "08_SimpleDataBinding" ;
- this.textbox = new System.Windows.Forms.TextBox ( ) ;
- textbox.Location = new System.Drawing.Point (8, 8);
- textbox.Size = new System.Drawing.Size ( 448 , 20 ) ;
- textbox.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right ;
- textbox.TabIndex = 0 ;
- this.Controls.Add ( textbox ) ;
- DataSet ds = CreateDataSet ( ) ;
- textbox.DataBindings.Add ( "Text" , ds.Tables["Products"] , "ProductName" ) ;
- }
- /// <summary>
- /// Create a DataSet for the example
- /// </summary>
- /// <returns>The Products DataSet</returns>
- private DataSet CreateDataSet ( )
- {
- string source = Login.Connection;
- string customers = "SELECT * FROM Products";
- SqlConnection con = new SqlConnection ( source ) ;
- SqlDataAdapter da = new SqlDataAdapter ( customers , con ) ;
- DataSet ds = new DataSet ( ) ;
- da.Fill ( ds , "Products" ) ;
- return ds ;
- }
- /// <summary>
- /// Display the application window
- /// </summary>
- static void Main()
- {
- Application.Run(new SimpleDataBinding());
- }
- }