Question: A web address book but I have 4 errors that I can't figure out: Severity Code Description Project File Line Suppression State Error CS0103 The
A web address book but I have 4 errors that I can't figure out:
| Severity | Code | Description | Project | File | Line | Suppression State |
| Error | CS0103 | The name 'dr' does not exist in the current context | AddressBook |
| 36 | Active |
| Error | CS0103 | The name 'connection' does not exist in the current context | AddressBook |
| 21 | Active |
| Error | CS0103 | The name 'con' does not exist in the current context | AddressBook |
| 24 | Active |
| Error | CS0103 | The name 'dr' does not exist in the current context | AddressBook |
| 34 | Active |
Default.aspx:
using System; using System.Collections.Generic; using System.Data; using System.Data.SqlClient; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls;
namespace AddressBook { public partial class Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { }
private void rep_bind() { connection(); string query = "select * from customer where Name like'" + TextBox1.Text + "%'";
SqlDataAdapter da = new SqlDataAdapter(query, con); DataSet ds = new DataSet(); da.Fill(ds); GridView1.DataSource = ds; GridView1.DataBind(); }
protected void Button1_Click(object sender, EventArgs e) { if (dr.HasRows) { dr.Read();
rep_bind(); GridView1.Visible = true;
TextBox1.Text = ""; Label1.Text = ""; } else { GridView1.Visible = false; Label1.Visible = true; Label1.Text = "The search Term " + TextBox1.Text + " Is Not Available in the Record"; } } } }
Label1.cs
namespace AddressBook { internal class Label1 { internal static bool Visible; internal static string Text; } }

f uuck Lo.nchtrl+UJ Any CPU Sul.liun Espo Firsmau Lastaame -ail Phoue abc ab: Seerch Emor Liet Project SSa Thename connection' doss noit in the current cor te 21 Active 2a Actve The name con dces nct euet in the curment contest lype here to search
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
