TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Krishna
NA
37
9.4k
comparing multiple strings with the database
Mar 23 2015 7:27 AM
i had a text box in which i am passing two string separated by (& )
example :hyderabad & goa
i want the strings to be compared with the database and display the result which is available in the database
i had a code
protected void Button1_Click(object sender, EventArgs e)
{
SqlCommand cmd = new SqlCommand("insert comparative values('" + TextBox1.Text + "','" + TextBox2.Text + "')", con);
cmd.ExecuteNonQuery();
SqlCommand scom = new SqlCommand();
scom.Connection = con;
scom.CommandText = "Select * from places where names= @Name";
scom.Parameters.AddWithValue("@Name", TextBox2.Text.ToString());
string[] myArray = TextBox2.Text.Split(new Char[] { '&' });
SqlDataReader sdr = scom.ExecuteReader();
if (sdr.Read())
{
Label4.Text = TextBox2.Text;
}
else
{
Label4.Text = "Not Found";
}
con.Close();
}
thanks in advance
Reply
Answers (
11
)
httphandlers and modules
c# windows application