سلام
یکی از دوستان این کد رو لطف کرد ...
public DataTable SelectData() {
string selectQuery = "Select Cam From Tsel Where Dat LIKE @d";
SqlCommand Command1 = new SqlCommand(selectQuery, this.con);
Command1.Parameters.AddWithValue("@d", toolStripStatusLabel13.Text);
SqlDataAdapter DataAdapter1 = new SqlDataAdapter(Command1);
try
{
DataTable result = new DataTable();
DataAdapter1.Fill(result);
return result;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
return null;
}
finally
{
Command1.Connection.Close();
}
}
و اینم فراخوانیش :
private void Form1_Load(object sender, EventArgs e) {
try
{
this.listBox1.DataSource = this.SelectData();
this.listBox1.DisplayMember = "Cam";
this.listBox1.ValueMember = "Dat";
}
catch
{
}
الان میخوام بر حسب تاریخ روز نشون بده ! ولی هیچی نشون نمیده ، و اگه دستور WHERE و خط زیر رو بردارم :
Command1.Parameters.AddWithValue("@d", toolStripStatusLabel13.Text);
همه رو نشون میده !
*** در واقع میخوام چک هایی که تاریخ سر رسیدشون ، تاریخ روز هستش رو نشون بده***