hotboys:
使用控件bdpConnection1,bdpDataAdapter1,dataSet1,dataGrid1.
code is as follows:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
namespace WebApplication5
{
/// <summary>
/// Summary description for WebForm1.
/// </summary>
public class WebForm1 : System.Web.UI.Page
{
protected Borland.Data.Provider.BdpConnection bdpConnection1;
protected Borland.Data.Provider.BdpDataAdapter bdpDataAdapter1;
protected Borland.Data.Provider.BdpCommand bdpSelectCommand1;
protected Borland.Data.Provider.BdpCommand bdpInsertCommand1;
protected Borland.Data.Provider.BdpCommand bdpUpdateCommand1;
protected Borland.Data.Provider.BdpCommand bdpDeleteCommand1;
protected System.Data.DataSet dataSet1;
protected System.Data.DataTable dataTable1;
protected System.Web.UI.WebControls.DataGrid dataGrid1;
protected System.Data.DataTable Table2;
protected System.Data.DataColumn dataColumn1;
protected System.Data.DataColumn dataColumn2;
protected System.Data.DataColumn dataColumn3;
protected System.Data.DataColumn dataColumn4;
protected System.Data.DataColumn dataColumn5;
private void Page_Load(object sender, System.EventArgs e)
{
this.dataGrid1.DataBind();
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// Required method for Designer support -do
not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.bdpConnection1 = new Borland.Data.Provider.BdpConnection();
this.bdpDataAdapter1 = new Borland.Data.Provider.BdpDataAdapter();
this.dataSet1 = new System.Data.DataSet();
this.dataTable1 = new System.Data.DataTable();
this.Table2 = new System.Data.DataTable();
this.dataColumn1 = new System.Data.DataColumn();
this.dataColumn2 = new System.Data.DataColumn();
this.dataColumn3 = new System.Data.DataColumn();
this.dataColumn4 = new System.Data.DataColumn();
this.dataColumn5 = new System.Data.DataColumn();
this.bdpDeleteCommand1 = new Borland.Data.Provider.BdpCommand();
this.bdpInsertCommand1 = new Borland.Data.Provider.BdpCommand();
this.bdpSelectCommand1 = new Borland.Data.Provider.BdpCommand();
this.bdpUpdateCommand1 = new Borland.Data.Provider.BdpCommand();
((System.ComponentModel.ISupportInitialize)(this.bdpDataAdapter1)).begin
Init();
((System.ComponentModel.ISupportInitialize)(this.dataSet1)).begin
Init();
((System.ComponentModel.ISupportInitialize)(this.dataTable1)).begin
Init();
((System.ComponentModel.ISupportInitialize)(this.Table2)).begin
Init();
this.dataGrid1.DataBinding += new System.EventHandler(this.Page_Load);
this.dataGrid1.Load += new System.EventHandler(this.Page_Load);
//
// bdpConnection1
//
this.bdpConnection1.ConnectionOptions = "";
this.bdpConnection1.ConnectionString = "assembly=Borland.Data.Mssql,Version=1.1.0.0,Culture=neutral,Public" +
"KeyToken=91d62ebb5b0d1b1b;vendorclient=sqloledb.dll;loginprompt=T" +
"rue;osauthen
tication=True;database=master;username=;hostname=jjh;" +
"password=;provider=MSSQL";
//
// bdpDataAdapter1
//
this.bdpDataAdapter1.Active = true;
this.bdpDataAdapter1.DataSet = this.dataSet1;
this.bdpDataAdapter1.DataTable = this.Table2;
this.bdpDataAdapter1.DeleteCommand = this.bdpDeleteCommand1;
this.bdpDataAdapter1.InsertCommand = this.bdpInsertCommand1;
this.bdpDataAdapter1.SelectCommand = this.bdpSelectCommand1;
this.bdpDataAdapter1.StartRecord = 0;
this.bdpDataAdapter1.UpdateCommand = this.bdpUpdateCommand1;
//
// dataSet1
//
this.dataSet1.CaseSensitive = true;
this.dataSet1.DataSetName = "NewDataSet";
this.dataSet1.Locale = new System.Globalization.CultureInfo("zh-CN");
this.dataSet1.Tables.AddRange(new System.Data.DataTable[] {
this.dataTable1,
this.Table2});
//
// dataTable1
//
this.dataTable1.TableName = "Table1";
//
// Table2
//
this.Table2.Columns.AddRange(new System.Data.DataColumn[] {
this.dataColumn1,
this.dataColumn2,
this.dataColumn3,
this.dataColumn4,
this.dataColumn5});
this.Table2.TableName = "Table2";
//
// dataColumn1
//
this.dataColumn1.ColumnName = "name";
//
// dataColumn2
//
this.dataColumn2.ColumnName = "age";
this.dataColumn2.DataType = typeof(int);
//
// dataColumn3
//
this.dataColumn3.ColumnName = "salary";
this.dataColumn3.DataType = typeof(int);
//
// dataColumn4
//
this.dataColumn4.ColumnName = "department";
//
// dataColumn5
//
this.dataColumn5.ColumnName = "id";
//
// bdpDeleteCommand1
//
this.bdpDeleteCommand1.CommandOptions = null;
this.bdpDeleteCommand1.CommandText = "DELETE FROM dbo.jjh_people WHERE name = ? AND age = ? AND salary =" +
" ? AND department = ? AND id = ?";
this.bdpDeleteCommand1.CommandType = System.Data.CommandType.Text;
this.bdpDeleteCommand1.Connection = this.bdpConnection1;
this.bdpDeleteCommand1.ParameterCount = ((short)(5));
this.bdpDeleteCommand1.Parameters.Add(new Borland.Data.Common.BdpParameter("nameOriginal", Borland.Data.Common.BdpType.String, Borland.Data.Common.BdpType.Unknown, 0, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "name", System.Data.DataRowVersion.Current, null));
this.bdpDeleteCommand1.Parameters.Add(new Borland.Data.Common.BdpParameter("ageOriginal", Borland.Data.Common.BdpType.Int32, Borland.Data.Common.BdpType.Unknown, 0, System.Data.ParameterDirection.Input, false, ((byte)(10)), ((byte)(0)), "age", System.Data.DataRowVersion.Current, null));
this.bdpDeleteCommand1.Parameters.Add(new Borland.Data.Common.BdpParameter("salaryOriginal", Borland.Data.Common.BdpType.Int32, Borland.Data.Common.BdpType.Unknown, 0, System.Data.ParameterDirection.Input, false, ((byte)(10)), ((byte)(0)), "salary", System.Data.DataRowVersion.Current, null));
this.bdpDeleteCommand1.Parameters.Add(new Borland.Data.Common.BdpParameter("departmentOriginal", Borland.Data.Common.BdpType.String, Borland.Data.Common.BdpType.Unknown, 0, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "department", System.Data.DataRowVersion.Current, null));
this.bdpDeleteCommand1.Parameters.Add(new Borland.Data.Common.BdpParameter("idOriginal", Borland.Data.Common.BdpType.String, Borland.Data.Common.BdpType.Unknown, 0, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "id", System.Data.DataRowVersion.Current, null));
this.bdpDeleteCommand1.SchemaName = null;
this.bdpDeleteCommand1.Transaction = null;
this.bdpDeleteCommand1.UpdatedRowSource = System.Data.UpdateRowSource.None;
//
// bdpInsertCommand1
//
this.bdpInsertCommand1.CommandOptions = null;
this.bdpInsertCommand1.CommandText = "INSERT INTO dbo.jjh_people (name, age, salary, department, id) VAL" +
"UES (?, ?, ?, ?, ?)";
this.bdpInsertCommand1.CommandType = System.Data.CommandType.Text;
this.bdpInsertCommand1.Connection = this.bdpConnection1;
this.bdpInsertCommand1.ParameterCount = ((short)(5));
this.bdpInsertCommand1.Parameters.Add(new Borland.Data.Common.BdpParameter("name", Borland.Data.Common.BdpType.String, Borland.Data.Common.BdpType.Unknown, 0, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "name", System.Data.DataRowVersion.Current, null));
this.bdpInsertCommand1.Parameters.Add(new Borland.Data.Common.BdpParameter("age", Borland.Data.Common.BdpType.Int32, Borland.Data.Common.BdpType.Unknown, 0, System.Data.ParameterDirection.Input, false, ((byte)(10)), ((byte)(0)), "age", System.Data.DataRowVersion.Current, null));
this.bdpInsertCommand1.Parameters.Add(new Borland.Data.Common.BdpParameter("salary", Borland.Data.Common.BdpType.Int32, Borland.Data.Common.BdpType.Unknown, 0, System.Data.ParameterDirection.Input, false, ((byte)(10)), ((byte)(0)), "salary", System.Data.DataRowVersion.Current, null));
this.bdpInsertCommand1.Parameters.Add(new Borland.Data.Common.BdpParameter("department", Borland.Data.Common.BdpType.String, Borland.Data.Common.BdpType.Unknown, 0, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "department", System.Data.DataRowVersion.Current, null));
this.bdpInsertCommand1.Parameters.Add(new Borland.Data.Common.BdpParameter("id", Borland.Data.Common.BdpType.String, Borland.Data.Common.BdpType.Unknown, 0, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "id", System.Data.DataRowVersion.Current, null));
this.bdpInsertCommand1.SchemaName = null;
this.bdpInsertCommand1.Transaction = null;
this.bdpInsertCommand1.UpdatedRowSource = System.Data.UpdateRowSource.None;
//
// bdpSelectCommand1
//
this.bdpSelectCommand1.CommandOptions = null;
this.bdpSelectCommand1.CommandText = "SELECT name, age, salary, department, id FROM dbo.jjh_people";
this.bdpSelectCommand1.CommandType = System.Data.CommandType.Text;
this.bdpSelectCommand1.Connection = this.bdpConnection1;
this.bdpSelectCommand1.ParameterCount = ((short)(0));
this.bdpSelectCommand1.SchemaName = null;
this.bdpSelectCommand1.Transaction = null;
this.bdpSelectCommand1.UpdatedRowSource = System.Data.UpdateRowSource.None;
//
// bdpUpdateCommand1
//
this.bdpUpdateCommand1.CommandOptions = null;
this.bdpUpdateCommand1.CommandText = "UPDATE dbo.jjh_people SET name = ?, age = ?, salary = ?, departmen" +
"t = ?, id = ? WHERE name = ? AND age = ? AND salary = ? AND depar" +
"tment = ? AND id = ?";
this.bdpUpdateCommand1.CommandType = System.Data.CommandType.Text;
this.bdpUpdateCommand1.Connection = this.bdpConnection1;
this.bdpUpdateCommand1.ParameterCount = ((short)(10));
this.bdpUpdateCommand1.Parameters.Add(new Borland.Data.Common.BdpParameter("name", Borland.Data.Common.BdpType.String, Borland.Data.Common.BdpType.Unknown, 0, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "name", System.Data.DataRowVersion.Current, null));
this.bdpUpdateCommand1.Parameters.Add(new Borland.Data.Common.BdpParameter("age", Borland.Data.Common.BdpType.Int32, Borland.Data.Common.BdpType.Unknown, 0, System.Data.ParameterDirection.Input, false, ((byte)(10)), ((byte)(0)), "age", System.Data.DataRowVersion.Current, null));
this.bdpUpdateCommand1.Parameters.Add(new Borland.Data.Common.BdpParameter("salary", Borland.Data.Common.BdpType.Int32, Borland.Data.Common.BdpType.Unknown, 0, System.Data.ParameterDirection.Input, false, ((byte)(10)), ((byte)(0)), "salary", System.Data.DataRowVersion.Current, null));
this.bdpUpdateCommand1.Parameters.Add(new Borland.Data.Common.BdpParameter("department", Borland.Data.Common.BdpType.String, Borland.Data.Common.BdpType.Unknown, 0, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "department", System.Data.DataRowVersion.Current, null));
this.bdpUpdateCommand1.Parameters.Add(new Borland.Data.Common.BdpParameter("id", Borland.Data.Common.BdpType.String, Borland.Data.Common.BdpType.Unknown, 0, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "id", System.Data.DataRowVersion.Current, null));
this.bdpUpdateCommand1.Parameters.Add(new Borland.Data.Common.BdpParameter("nameOriginal", Borland.Data.Common.BdpType.String, Borland.Data.Common.BdpType.Unknown, 0, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "name", System.Data.DataRowVersion.Current, null));
this.bdpUpdateCommand1.Parameters.Add(new Borland.Data.Common.BdpParameter("ageOriginal", Borland.Data.Common.BdpType.Int32, Borland.Data.Common.BdpType.Unknown, 0, System.Data.ParameterDirection.Input, false, ((byte)(10)), ((byte)(0)), "age", System.Data.DataRowVersion.Current, null));
this.bdpUpdateCommand1.Parameters.Add(new Borland.Data.Common.BdpParameter("salaryOriginal", Borland.Data.Common.BdpType.Int32, Borland.Data.Common.BdpType.Unknown, 0, System.Data.ParameterDirection.Input, false, ((byte)(10)), ((byte)(0)), "salary", System.Data.DataRowVersion.Current, null));
this.bdpUpdateCommand1.Parameters.Add(new Borland.Data.Common.BdpParameter("departmentOriginal", Borland.Data.Common.BdpType.String, Borland.Data.Common.BdpType.Unknown, 0, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "department", System.Data.DataRowVersion.Current, null));
this.bdpUpdateCommand1.Parameters.Add(new Borland.Data.Common.BdpParameter("idOriginal", Borland.Data.Common.BdpType.String, Borland.Data.Common.BdpType.Unknown, 0, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "id", System.Data.DataRowVersion.Current, null));
this.bdpUpdateCommand1.SchemaName = null;
this.bdpUpdateCommand1.Transaction = null;
this.bdpUpdateCommand1.UpdatedRowSource = System.Data.UpdateRowSource.None;
this.Load += new System.EventHandler(this.Page_Load);
this.DataBinding += new System.EventHandler(this.Page_Load);
((System.ComponentModel.ISupportInitialize)(this.bdpDataAdapter1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.dataSet1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.dataTable1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.Table2)).EndInit();
}
#endregion
}
}
<%@ Page language="c#" Debug="true" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false" Inherits="WebApplication5.WebForm1" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title></title>
<meta name="GENERATOR" content="Borland ASP.NET Designer for c# Package Library 7.1">
</head>
<body ms_positioning="GridLayout">
<form runat="server">
<asp:datagrid id=dataGrid1 style="POSITION: absolute" runat="server"
height="170px" datasource="<%# dataSet1 %>"
datamember="Table2" borderstyle="None" gridlines="Vertical"
borderwidth="1px" bordercolor="#999999" backcolor="White"
cellpadding="3" width="519px">
<footerstyle forecolor="Black" backcolor="#CCCCCC">
</footerstyle>
<headerstyle font-bold="True" forecolor="White" backcolor="#000084">
</headerstyle>
<pagerstyle horizontalalign="Center" forecolor="Black"
backcolor="#999999" mode="NumericPages">
</pagerstyle>
<selecteditemstyle font-bold="True" forecolor="White"
backcolor="#008A8C">
</selecteditemstyle>
<alternatingitemstyle backcolor="Gainsboro">
</alternatingitemstyle>
<itemstyle forecolor="Black" backcolor="#EEEEEE">
</itemstyle>
</asp:datagrid>
</form>
</body>
</html>