C# Windows Form - Using text from textBox in Query

  • Thread starter Thread starter menidavid
  • Start date Start date
M

menidavid

Hi!!!

i need to show report from database (I use MicrosortReportViewer) by
insert a date to textBox and press on Query

How can i use the date from the textBox in the query

i try

SELECT מזהה, id, last_name, first_name, num_car, insurance_type,
insurance_company, end_insurance, num_file, phone, mobile, address,
city,
reference_company, reference_type
FROM phon
WHERE (end_insurance = textBox1.Text)

it's not good
 
On 01/01/2009 in message
<[email protected]>
WHERE (end_insurance = textBox1.Text)

textBox1.Text is a string, try converting it to a DateTime.
I always use integers for this sort of thing - calculate the number of
days from a fixed start date when adding/updating a record and keep it in
the DB as an integer. It overcomes any differences in date formats and is
probably a bit quicker. I convert it back to a DateTime to display it.
 
Back
Top