I want to find a specific date (using text box) and allow the database to show them all I have already compiled the information I entered in that date, shown below:
selected date ([test result]), [user / test] from WHERE Date '%' + @value + '%' / Code> I have used the data grid view on a phone so that the sub To see a blind search, a cover box and a search button have been added and I have used the code given below this button:
this.user_TestTableAdapter.search (this. QuestionareDataSet1._User_Test, textBox1.Text);
The error I get is that a word with a date can not be compared, which I understand. Do I need to convert the search date to string?
Thank you.
Compose the date on the input field in the format "secure" (jQuery for websites See date in the blink method).
var selectedDate = Convert.ToDateTime (txtInputDate.Value); Var sql = "SELECT * FROM from table to WHERE date field" "+ selectedDate.ToString (" yyyy-MM-dd ") +" 'and now (); ";
You can also do such things ...
var dateAddDaysValue = 2; ("Yyyy-MM-dd") + "'and" "+ Selected date. AddDays (dateAddDaysValue). Ostring (" yyyy-MM-dd ") + "';';
Cheerio!
Edit: You should know that this method of building SQL queries is very low for injection. Make sure you are hybriding your questions properly.
No comments:
Post a Comment