Results 1 to 7 of 7

Thread: whts wrong with the sql statement [resolved]

Threaded View

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 2004
    Posts
    100

    whts wrong with the sql statement [resolved]

    i have a code from some source that display data from database to the flexgrid.

    the prob is i want the data to be displayed depend on the selected date.
    so i just put the sql statement which i think (may be the sql statement is wrong..) will display data according to the date.
    and, an error ocurred whis is datatype mismatch and it points to the sql statement. why is that so??

    VB Code:
    1. Private Sub Command4_Click()
    2. On Error GoTo errHandler
    3. Set Conn = GetConnection
    4. Set rs = New ADODB.Recordset
    5. rs.Open "SELECT * FROM pemeriksaanBM WHERE tarikh = '" & DTPicker1.Value & "'", Conn, adOpenStatic, adLockOptimistic
    6. 'rs.Open "SELECT * FROM pemeriksaanBM ", Conn, adOpenStatic, adLockOptimistic
    7.  
    8. With rs
    9.     If Not .EOF Then
    10.       FG_ShowRecordset MSFlexGrid2, rs
    11.     End If
    12.     .Close
    13.   End With
    14.   Conn.Close
    15.  
    16. Set Conn = Nothing
    17.   Set rs = Nothing
    18.   Exit Sub
    19.  
    20. errHandler:
    21.   MsgBox "An error occured." & vbLf & Err.Number & ": " & Err.Description, vbCritical
    22.   Set Conn = Nothing
    23.   Set rs = Nothing
    24.  
    25. End Sub
    Last edited by azrina; Jan 25th, 2004 at 05:01 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width