1
Reply

sql date comparaison

DDDSD DFEZFZ

DDDSD DFEZFZ

Oct 5 2008 1:36 PM
2.4k

i've a problem in my sql request as you here :

string SQL_str;

System.DateTime now = System.DateTime.Now;

DateTime d = now.AddDays(2);

SQL_str = "SELECT DemandID, FirstName, LastName, SDate, EDate FROM dbo.RentDemand where SDate = @d";

String Con = @"Data Source=USER\SQLEXPRESS;Initial Catalog=RentDB;Integrated Security=True";

SqlDataAdapter dataAdapter = new SqlDataAdapter(mySQL, Con);

SqlCommandBuilder commandBuilder = new SqlCommandBuilder(dataAdapter);

DataTable table = new DataTable();

table.Locale = System.Globalization.CultureInfo.InvariantCulture;

dataAdapter.Fill(table);

rentDemandBindingSource.DataSource = table;

dataGridView2.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCellsExceptHeader);dataGridView2.ReadOnly = true;

dataGridView2.DataSource = rentDemandBindingSource;

 

 it doesnt work ,can anyone show me what's the problemm ?


Answers (1)