using System; using System.Configuration; using System.Data; using System.Data.OleDb; 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; public partial class _Default : System.Web.UI.Page { OleDbConnection conn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:/Documents and Settings/abby1/My Documents/Visual Studio 2008/WebSites/WebSite3/App_Data/TEST.mdb"); OleDbDataReader rdr = null; protected void Page_Load(object sender, EventArgs e) { } protected void TextBox1_TextChanged(object sender, EventArgs e) { } protected void Button1_Click(object sender, EventArgs e) { try { conn.Open(); OleDbCommand str = new OleDbCommand("select appno from final", conn); OleDbDataReader rdr = str.ExecuteReader(); DataSet ds = new DataSet(); if (rdr.HasRows) { while (rdr.Read()) { if (rdr.Read()) { TextBox1.Text = rdr.GetValue(0).ToString(); } s = dr.GetData(); TextBox1.Text = Convert.ToString(str); } } } catch { conn.Close(); } } private string ToString(string p) { throw new NotImplementedException(); } }
↧
task: to retrieve data from access file to textbox1 on button click
↧