Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 Other Development Tools
 problem with date

Author  Topic 

husseinj
Starting Member

8 Posts

Posted - 2004-08-13 : 03:17:49
Hi everyone,

It would be good if i can store the data i get from my datagrid in a file.

Please can you help me with this syntax:
Actually am using this syntax for ms access 2003 and its working on fine.
The problem is with the date
dim x as Date
x = DTPicker1.Value
If Combo1.Text = "All" Then

Adodc1.RecordSource = "select POL_REF_NO, FREQ, NX_EXP_PR_DT, GROSS_PREMIUM" & _
" from POLICY" & _
" where (POL_STAT = 'A')" & _
" and (freq = 1)" & _
" and (nx_exp_pr_dt = #" & x & "# )"

Adodc1.Refresh
Set DataGrid1.DataSource = Adodc1


It does not understand the (nx_exp_pr_dt = #" & x & "# ), i think its a syntax problem. it does not understand the # sign?
Can anyone please help me




spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2004-08-13 : 09:14:20
you can't compare dates like that:
you need to convert your date into the varchar:
declare @Date varchar(10)
set @Date = '22.06.2004' -- dd.mm.yyyy
SELECT ...
WHERE ... and (convert(DATETIME, @Date, 104) = nx_exp_pr_dt)

check Books Online for convert() for codes in date conversion and use the one your dates are in.

Go with the flow & have fun! Else fight the flow :)
Go to Top of Page
   

- Advertisement -