I am developing mobile application in C#. I am using the SQLite database to store the data. In the SQLite database I am storing the information related to the customer. In that I am storing the date with mm/dd/yy 12:54:30 PM format. Now I want to retrive the customer data based on start date & end date. I am using the following code
ShowRegistrationKeyDetails ShowRegKeyDetailsObj = new ShowRegistrationKeyDetails();
// set properties
ShowRegKeyDetailsObj.FromDate = FromdateTimePicker.Value.ToString();
ShowRegKeyDetailsObj.ToDate = TodateTimePicker.Value.ToString();
When I fire the SQL Queries based on these values I am not getting the proper result. I need to convert the above values of FromdateTimePicker.Text & TodateTimePicker.Text into the mm/dd/yy 12:54:30 PM format. I am using the following code
public SQLiteDataReader getClient_And_RegistrationKeys(int Customer_ID, String FromDt, String ToDt)
{
SQLiteDataReader SQLLiteDrObj = null;
DataManager myDatabase = new DataManager("CompNet.db");
myDatabase.Init(false);
string[] Parameter = new string[] { "@Val_Customer_ID", "@Val_FromDt", "@Val_ToDt" };
Object[] Objval = new Object[] { Customer_ID, FromDt, ToDt };
string sqlCommandText = "Select Activation_Date, Standard_ID, Client_Key, Registration_Key from Activation_Details where Customer_ID=@Val_Customer_ID And Activation_Date between @Val_FromDt And @Val_ToDt";
SQLLiteDrObj = myDatabase.ExecuteReader(sqlCommandText, Parameter, Objval);
return SQLLiteDrObj;
}
I have tried this code. Now I am getting the date in the format in which I want but I am not getting the required rows as output. There is no row in the output. Where I am going wrong ? Can you please provide me any code?