1
Answer

Why??

Photo of 7450821

7450821

20y
1.9k
1
public DataSet GetClass() { SqlConnection myConnection=new SqlConnection(ConfigurationSettings.AppSettings["connectionString"]); SqlDataAdapter countCmd=new SqlDataAdapter("select *,(select count(*) from Class where ParentId=g.SubId) as nCount from Class g",myConnection); DataSet dstClass=new DataSet(); countCmd.Fill(dstClass); return dstClass; } DataBinder.Eval: 'System.Data.DataRowView' does not contain a property with the name nCount. why? Is anybody could help me?

Answers (1)

0
Photo of Scott Lysle
NA 28.5k 14.4m 16y

Not sure what you mean; here is a way to search for a match and a way to select (highlight) a match:

        // search for a match

        private void button1_Click(object sender, EventArgs e)

        {

            foreach (string s in listBox1.Items)

            {

                if (s == textBox1.Text)

                    MessageBox.Show("Found: " + s);

            }

        }

 

        // select the match

        private void button2_Click(object sender, EventArgs e)

        {

            for(int i=0; i<listBox1.Items.Count; i++)

            {

                if (listBox1.Items[i].ToString() == textBox1.Text)

                    listBox1.SelectedIndex = i;

            }

        }