PC Review


Reply
Thread Tools Rate Thread

C# Windows Form - Using text from textBox in Query

 
 
menidavid@gmail.com
Guest
Posts: n/a
 
      1st Jan 2009
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

 
Reply With Quote
 
 
 
 
Jeff Gaines
Guest
Posts: n/a
 
      1st Jan 2009
On 01/01/2009 in message
<a6ca3628-b7a7-4a45-be05-(E-Mail Removed)>
(E-Mail Removed) wrote:

>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.

--
Jeff Gaines Damerham Hampshire UK
All those who believe in psychokinesis raise my hand.
 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Query using form textbox. Moon Walker Microsoft Access Queries 6 13th Sep 2008 10:11 AM
RE: Query using form textbox. KARL DEWEY Microsoft Access Queries 0 11th Sep 2008 03:54 PM
How to pass textBox.Text to Sql query Tim Sprout Microsoft C# .NET 3 28th Jun 2007 04:56 PM
Setting the Control source of a textbox to a query based on the valueof another textbox on the same form Joey Microsoft Access Queries 1 26th Jan 2005 03:35 AM
Updating Windows Form TextBox.Text w/ a Timer (c#) =?Utf-8?B?Q2FzZQ==?= Microsoft Dot NET Framework Forms 4 27th Apr 2004 08:16 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:37 PM.