3
Answers

listview

i have saved an image creating a folder in my project.how to get that image in a listview to set as a default image
Answers (3)
0
Amit Gupta

Amit Gupta

NA 16.5k 25.6k 8y
Hi Dear

Try to alter the query... use

Date>=@startDate and Date <=@enddate

// now pass the parameter as u r doing..

Hope it helps
0
Atul Rokade

Atul Rokade

NA 141 17k 8y
sir i implemented your code like this below
 
string connetionString = null;
connetionString = ConfigurationManager.ConnectionStrings["AccessConnectionString"].ConnectionString;
cnn.ConnectionString = connetionString;
cmd = new OleDbCommand("SELECT * FROM Billing " + "WHERE Date between ? AND ?");
cmd.Parameters.AddWithValue("?", dateTimePicker1.Value);
cmd.Parameters.AddWithValue("?", dateTimePicker2.Value);
OleDbConnection connection = new OleDbConnection(connetionString);
OleDbDataAdapter dataadapter=new OleDbDataAdapter ();
DataSet ds = new DataSet();
connection.Open();
dataadapter.SelectCommand = cmd;
connection.Close();
dataGridView1.DataSource = ds;
 
but now what happen if i select start_date suppose 1/02/2016 and end_date is 22/03/2016 and click show Report nothing is coming into datagridview but there is a one entry of 17/02/2016 date for refernce i given two image
 
 
 
 
0
Krishna Rajput Singh

Krishna Rajput Singh

NA 5.5k 2m 8y
you welcome Atul well helpful for you mark as correct answer
0
Krishna Rajput Singh

Krishna Rajput Singh

NA 5.5k 2m 8y
you welcome Atul well helpful for you mark as correct answer
0
Atul Rokade

Atul Rokade

NA 141 17k 8y
thank you krishna sir for reply i will check whatever links you given , thank you once again :)
0
Atul Rokade

Atul Rokade

NA 141 17k 8y
thank you sir for reply but m not understnd how i put datetimepicker in query all query which is given
0
Krishna Rajput Singh

Krishna Rajput Singh

NA 5.5k 2m 8y
Hello Atul Rokade thanks foe writing below links i hope helpful for you...:)
 
http://stackoverflow.com/questions/541225/how-can-i-set-a-datetimepicker-control-to-a-specific-date
 
http://stackoverflow.com/questions/19934793/set-datetimepicker-control-to-format-yyyymmdd
 
https://msdn.microsoft.com/en-us/library/ms229631(v=vs.110).aspx 
0
Suthish Nair

Suthish Nair

NA 31.7k 4.6m 8y
Am not sure what issue you are facing... try this...
cmd.CommandText =
"SELECT * FROM Billing " +
"WHERE Date Between ? And ?";
cmd.Parameters.AddWithValue("?", dateControl1.value/text);
cmd.Parameters.AddWithValue("?", dateControl2.value/text);
or
OleDbCommand command = new OleDbCommand(
"SELECT * FROM Billing " +
"WHERE Date between @DateStart AND @DateEnd");
command.Parameters.AddWithValue("@DateStart",dateTimePicker1.Value.Date);
command.Parameters.AddWithValue("@DateEnd",dateTimePicker2.Value.Date);
 
Next Recommended Forum