Question
One Error Left: Severity Code Description Project File Line Suppression State Error CS1729 'SqlDataReader' does not contain a constructor that takes 0 arguments AddressBook 34
One Error Left:
Severity | Code | Description | Project | File | Line | Suppression State |
Error | CS1729 | 'SqlDataReader' does not contain a constructor that takes 0 arguments | 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() { SqlConnection con = new SqlConnection("Data Source=(local);Initial Catalog=Northwind;Integrated Security=SSPI"); //here you need mention your Datasource details 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) { SqlDataReader dr = new SqlDataReader(); 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"; } } } }
Label.cs
namespace AddressBook { internal class Label1 { internal static bool Visible; internal static string Text; } }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started