用数据库邦定控件是对winform编程常用的方法,以下是我的经验和方法:
using System;
using System.Windows.Forms;
using System.Data;
using System.Data.OleDb;
using Sybase.DataWindow;
using System.Data.SqlClient;
namespace Data
{
///
/// Form1 的摘要说明。
///
public class Form1 : System.Windows.Forms.Form
{
................//其它无关控件
private System.Data.OleDb.OleDbConnection
con;
private System.Data.OleDb.OleDbCommand command;
private System.Data.OleDb.OleDbDataReader
reader;
private System.Windows.Forms.ComboBox comboBox1;
..................//这里是窗体设计代码
private void Form1_Load(object sender, System.EventArgs e)
{
try
{
con = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=