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
Goran Bibic
479
2.9k
200.6k
Filter datatable c#
May 26 2018 7:30 AM
Filter datatable from text box and datetime picker
private
void
izvjestajoprodanimartiklima()
{
using
(SqlConnection openCon =
new
SqlConnection(cs))
{
String saveStaff =
"SELECT roba as 'Naziv artikla', SUM (cast(kolicina as float)) as 'Kolicina' from (select roba, kolicina from mp_racun_roba union all select roba, kolicina from mp_faktura_roba) as alltables group by roba"
;
if
(!string.IsNullOrEmpty(textBox1.Text))
{
saveStaff +=
"roba LIKE '%"
+ textBox1.Text +
"%' "
;
}
if
(checkBox1.Checked)
{
String strFilterDTP1 = dateTimePicker1.Value.ToString(
"yyyy-MM-dd"
);
String strFilterDTP2 = dateTimePicker2.Value.ToString(
"yyyy-MM-dd"
);
saveStaff += strFilterDTP1 +
" 00:00:00' AND '"
+ strFilterDTP2 +
" 23:59:59' "
;
}
error line 14 Incorrect syntax near the keyword 'LIKE'.
Some help?
Reply
Answers (
4
)
Object Initialization in ASP.Net webForm
SQL QUERY - URGENT.. PLS HELP