🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: be.comp.programming
Article #13895

data filteren via SQL

#13895
From: Daffy Duck
Date: Wed, 23 May 2001 21:45
24 lines
1625 bytes
Ik zou graag gegevens filteren tussen 2 datums via SQL.
Ik heb onderstaande code geschreven, maar ik krijg deze error:
Run-time error '-2147217900(80040e14)':
[Microsoft][ODBC SQL Server Drive] [SQL Server] Line 1:
Incorrect syntax near '#'

Private Sub Command1_Click()
  Dim db As New ADOdb.Connection
  Dim adoPrimaryRS as New ADOdb.RecordSet
  db.CursorLocation = adUseClient
  db.Open "PROVIDER=MSDASQL;driver={SQL
Server};server=PC2;uid=sa;pwd=;database=sampleSQL6;"
Dim sql1 As String
sql1 = "select * from tblSamples WHERE LoginDate BETWEEN #" &
CDate(Text1.Text) & "# AND #" & CDate(Text2.Text) & "#"

  adoPrimaryRS.Open sql1, db, adOpenStatic, adLockOptimistic

  Set grdDataGrid.DataSource = adoPrimaryRS
End Sub

Kan iemand mij hierbij helpen ??

Inge.
Technical Details
Message-ID: <3b0c3027$0$3124$456d72a3@news.skynet.be>
Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-03!supernews.com!nntp.cs.ubc.ca!skynet.be!louie!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: fcea4,55004f7176a513c1,start
X-Google-Attributes: gidfcea4,public
X-Google-ArrivalTime: 2001-05-23 14:50:03 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-03!supernews.com!nntp.cs.ubc.ca!skynet.be!louie!not-for-mail
From: "Daffy Duck" <jjj@planetinternet.be>
Newsgroups: be.comp.programming
Subject: data filteren via SQL
Date: Wed, 23 May 2001 23:45:20 +0200
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4133.2400
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400
Lines: 26
Message-ID: <3b0c3027$0$3124$456d72a3@news.skynet.be>
Organization: -= Skynet Usenet Service =-
NNTP-Posting-Host: 217.136.105.42
X-Trace: 990654503 reader0.news.skynet.be 3124 217.136.105.42
X-Complaints-To: abuse@skynet.be