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 error
Aug 2 2010 8:28 PM
i've created a select command which then fills a dataset, the input comes from a textbox but when i run the program and searc, i have an error.
private
void
buttonSearch_Click(
object
sender,
EventArgs
e)
{
if
(radioButtonCustomerID.Checked ==
true
)
{
try
{
string
selectString =
"SELECT * FROM Customers WHERE CustomerID LIKE"
+ textBoxSearch.Text +
""
;
SqlCommand
myCommand = sqlConnectionNW.CreateCommand();
myCommand.CommandText = selectString;
sqlDataAdapterSearch.SelectCommand = myCommand;
sqlConnectionNW.Open();
sqlDataAdapterSearch.Fill(dataSetSearch);
}
catch
(
Exception
ex)
{
MessageBox
.Show(ex.Message);
}
finally
{
sqlConnectionNW.Close();
}
}
}
the error i receive once the button is clicked is :
an expression of non-boolean type specified in a context where a condition is expected, near 'LIKE'
any help on the problem would be appreciated
thanks
Reply
Answers (
2
)
sql select command where CustomerId LIKE textbox.text
Drawing in C# Windows Form