i want to make a connection with database which will work on windows form load event
and populate records in datagrid view which are of last five days mean select all records by subtracting 5 days from present date.
plz help me i have no idea.
Loading
Iftikar HussainPosted Jul 28, 2013, 2:29 AM
Regards,
Iftikar
Iftikar HussainPosted Jul 28, 2013, 2:16 AM
Regards,
Iftikar
ta muPosted Jul 28, 2013, 2:13 AM
if you can
thank you
Iftikar HussainPosted Jul 25, 2013, 11:37 AM
Regards,
Iftikar
VulpesPosted Jul 25, 2013, 11:12 AM
string command = "SELECT * FROM Table WHERE DateColumn = '" + dateTimePicker1.Value.AddDays(-5).ToString("dd/MM/yyyy") + "'";
ta muPosted Jul 25, 2013, 10:52 AM
Iftikar HussainPosted Jul 24, 2013, 9:08 AM
Try like this
select *FROM YourTable DATEDIFF(dd,GETDATE(),YourDateColumn)<=5
Regards,
Iftikar
Riyaz AkhtarPosted Jul 24, 2013, 9:04 AM
SELECT * FROM TABLENAME WHERE dateColumnname >= convert(varchar(10), DATEADD(DAY, -5, GETDATE()), 120) AND dateColumnname<=GETDATE()
This query will fetch last 5 days records
ta muPosted Jul 24, 2013, 8:50 AM
Riyaz AkhtarPosted Jul 24, 2013, 7:54 AM