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
Rose Rouge
NA
27
8.7k
Search Query with multiple fields Winforms
Jun 30 2016 5:15 AM
I need to write a SQL Query for search with multiple fields .
I wrote this sql query but i can't make it work correctly
(User select check-box, choose a date between two dates and select Client Name from ComboBox.)
My query something like this :
private
void
btnRechercher_Click(
object
sender, EventArgs e)
{
if
(radBtnExport.Checked==
true
||radBtnImport.Checked==
true
||radBtnTransit.Checked==
true
||dateFin.Value>dateDebut.Value||comboBox1.SelectedValue.ToString()==
""
)
{
SqlConnection con =
new
SqlConnection(
"Data Source=Admin-PC\\SQLEXPRESS;Initial Catalog=timar;Integrated Security=True"
);
SqlDataAdapter sda =
new
SqlDataAdapter(
"Select * from Devis_C_L,Client where Devis_C_L.ClientId = Client.idClient and NomClient='"
+ comboBox1.Text +
"' or Sense='Transit' or Sense='Export' or Sense='Import' and DateTransport between '"
+ dateDebut.Value.Date.ToShortDateString() +
"' and'"
+ dateFin.Value.Date.ToShortDateString() +
"' "
, con);
DataTable dt =
new
DataTable();
sda.Fill(dt);
dataGridView1.DataSource = dt;
}
}
Please help me !
Thanks in Advance.
Reply
Answers (
5
)
add two Binary number
How can i Datagridview column format