How to pass Parameters with single quotes in it from vb6 to sqlserver

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • romiverma
    New Member
    • Jun 2010
    • 11

    How to pass Parameters with single quotes in it from vb6 to sqlserver

    Hi All,
    how to send parameters with single quotes from vb6 to sql server2000 e.g
    strFilter='wher e student_id like '21%' and '
    sqlstr = "Cmsp_StudentAn alysis('" & Format(dtpFrom. Value, "mm/dd/yyyy 00:00:00") & "','" & Format(dtpTo.Va lue, "mm/dd/yyyy 23:59:59") & "','" & strFilter & "')"
    connection.Exec ute sqlstr
    while executing its giving error bcoz my parameter is having single quotes in it.
    Plz help
    Last edited by romiverma; Jun 22 '10, 10:51 AM. Reason: Was incomplete
  • Brad Orders
    New Member
    • Feb 2008
    • 21

    #2
    Hi romiverma

    Try replacing all single quotes with two single quotes.

    (eg. ' becomes '').

    Hope this helps.

    Brad Orders

    Comment

    • romiverma
      New Member
      • Jun 2010
      • 11

      #3
      hi ! thanks it works

      Comment

      Working...