using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data.OleDb; using System.Data; public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void Button1_Click(object sender, EventArgs e) { OleDbConnection connection = new OleDbConnection(); connection.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|Data.accdb;Persist Security Info=True"; connection.Open(); OleDbCommand mycommand = new OleDbCommand(); mycommand.Connection = connection; mycommand.CommandType = CommandType.Text; String myquery1 = "select * from users where UserName = '" + TextBox1.Text + "' and Password = '" + TextBox2.Text + "' "; String myquery2 = "delete"; String myquery3 = "update"; String myquery4 = ""; String myquery5 = ""; mycommand.CommandText = myquery1; OleDbDataReader myreader = mycommand.ExecuteReader(); try { Label3.Text = "Wellcome " + Session["UserName"] = myreader[1].ToString(); } catch (Exception) { Label3.Text="Error"; } } }