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();
Joginder BangerPosted Mar 23, 2015, 4:18 AM
try this type:-
if (sdr.HasRows) {
while (sdr.Read())
{ /////your stuff here }
} else
{ TextBox1.Text = "No rows found."; }
Manish Kumar ChoudharyPosted Mar 23, 2015, 3:24 AM
KrishnaPosted Mar 23, 2015, 3:22 AM
Manish Kumar ChoudharyPosted Mar 23, 2015, 3:17 AM