Results 1 to 6 of 6

Thread: Delete problem

  1. #1
    Join Date
    May 2004
    Posts
    28

    Unanswered: Delete problem

    Code:
    DELETE FROM tblGradeScales
    WHERE (classId = 5) AND (quarter = 1) AND (gradeLetter = 'B+')
    I can delete all grade letters except the A+, B+, C+ and D+. Seems strange to me because its inside quotes. Anyone have any ideas

  2. #2
    Join Date
    May 2004
    Posts
    28
    I've just wrote the dynamic sql out to my web page and found that the + is getting dropped somehow.

    querystring data:
    Code:
    ?gradeLetter=D+&action=delete
    build sql code:
    Code:
    sqlGrade = "DELETE FROM tblGradeScales " & _
    "WHERE (classId = " & Session("classId") & ") AND (quarter = " & Session("currentQuarter") & ") AND (gradeLetter = N'" & Request.QueryString("gradeLetter") & "')"
    
    With oGrade
        .CommandText = sqlGrade
        .Execute
    End With
    final sql sent to the db:
    Code:
    DELETE FROM tblGradeScales WHERE (classId = 11) AND (quarter = 4) AND (gradeLetter = N'D ')
    Is there a special % character I need in order to extract the + sign from the querystring?

  3. #3
    Join Date
    Aug 2003
    Location
    Kingston, Ontario
    Posts
    106
    What happens if you use %43

  4. #4
    Join Date
    May 2004
    Posts
    28
    I tried:
    Code:
    Server.URLEncode(rsGrades("gradeLetter"))


    hoping that this would replace any + signs with %43 but it left it a + sign I'm hoping that I don't have to write code to inspect the grade letter to see if it has a + sign then set it to %43, I'm looking for something simpler like the URLEncode function that will convert it for me.

  5. #5
    Join Date
    Aug 2003
    Location
    Kingston, Ontario
    Posts
    106
    What about the replace function as in...

    NewGrade = Replace(rsGrades("gradeLetter"), "+", "%43")

  6. #6
    Join Date
    May 2004
    Posts
    28
    Code:
    Server.URLEncode(rsGrades("gradeLetter"))
    The reason I thought this wouldn't work is because I just hovered over the delete link and it wasn't any different from the one without the URLEncode function, I expected to see gradeLetter=D%2B&action=delete in the status bar. However when I actually click the delete link using the URLEncode function the delete link works. So I applologize for misleading anyone, the Server.URLEncode function works just perfectly, thanks for your input.
    Last edited by lcsgeek; 07-20-04 at 15:25.

Posting Permissions

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