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
Saafia NM
NA
52
11.2k
Select Query is not working
Feb 29 2016 6:47 AM
Table Name:Index
ID
Keyword
123,345,567
Test
I tried to get the ID values in a TextBox2 using following Code while entering the Keyword in TextBox1:
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["Connection"].ToString());
protected void Button1_Click(object sender, EventArgs e)
{
SqlCommand cmd = new SqlCommand("select ID from Index where Keyword=@keyword",con);
cmd.Parameters.AddWithValue("@keyword",TextBox1.Text);
con.Open();
SqlDataReader dt = cmd.ExecuteReader();
if (dt.Read())
{
TextBox2.Text = dt.ToString();
}
But i got the result as
"System.Data.SqlClient.SqlDataReader" in the TextBox2 ; what is the problem in my code???
Reply
Answers (
7
)
How to customize NopCommerce
change date time picker to show UTC instead of local time