在窗体设置4个标签
using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.OleDb;
public partialclass _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string sAccessConnection =@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\DataBase\xxx.mdb";
OleDbConnection odcConnection =new OleDbConnection(sAccessConnection);
odcConnection.Open();
OleDbCommand odCommand = odcConnection.CreateCommand();
odCommand.CommandText = "SELECT table.编号, table.[123], table.[456] FROM [table];";
OleDbDataReader odrReader = odCommand.ExecuteReader();
this.Label1.Text = "asd";
while (odrReader.Read())
{
this.Label2.Text = odrReader[0].ToString();
this.Label3.Text = odrReader[1].ToString();
this.Label4.Text = odrReader[2].ToString();
}
odrReader.Close();
odcConnection.Close();
}
}