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
Ryan Thomas
NA
13
21.2k
sql select command where CustomerId LIKE textbox.text
Aug 2 2010 6:23 PM
i'm attempting to use a select statement which retrieves products 'LIKE' textbox.text. However, i am given an error and cannot find a solution
private
void
buttonSearch_Click(
object
sender,
EventArgs
e)
{
if
(radioButtonCustomerID.Checked ==
true
)
{
try
{
sqlConnectionNW.Open();
sqlDataAdapterSearch.SelectCommand =
"SELECT * FROM Customers WHERE (CustomerID LIKE'"
+ textBoxSearch.Text +
"')"
;
}
catch
(
Exception
ex)
{
MessageBox
.Show(ex.Message);
}
finally
{
sqlConnectionNW.Close();
}
}
the eror given is
"cannot implicitly convert type 'string' to 'System.Data.SqlClient.SqlCommand"
Any help would be highly appreciated as it has stopped me dead in my tracks
thanks
Reply
Answers (
5
)
Image location to MySql Database
sql select error