myarray
SqlCommand cmd = new SqlCommand("insert comparative values('" + TextBox1.Text + "','" + TextBox2.Text + "')", con);
string[] myArray = TextBox2.Text.Split(new Char[] { '&' });
cmd.ExecuteNonQuery();
cmd.Connection = con;
cmd.CommandText = "select * from places where names = @myArray ";
cmd.Parameters.AddWithValue("@myArray", myArray.ToString());
SqlDataReader sdr = cmd.ExecuteReader();
if (sdr.Read())
{
Label4.Text = TextBox2.Text;
}
else
{
Label4.Text = "Not Found";
}
con.Close();
con.Close();

Manish Kumar ChoudharyRank #339 · 7.4K reputationPosted Mar 22, 2015, 11:17 PM EDT
Krishna39 reputationPosted Mar 22, 2015, 11:22 PM EDT
Manish Kumar ChoudharyRank #339 · 7.4K reputationPosted Mar 22, 2015, 11:24 PM EDT
Joginder BangerRank #360 · 7K reputationPosted Mar 23, 2015, 12:18 AM EDT
try this type:-
if (sdr.HasRows) {
while (sdr.Read())
{ /////your stuff here }
} else
{ TextBox1.Text = "No rows found."; }