Showing posts with label grade. Show all posts
Showing posts with label grade. Show all posts

Friday, February 17, 2012

Delete problem

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 :confused:I've just wrote the dynamic sql out to my web page and found that the + is getting dropped somehow.

querystring data:

?gradeLetter=D+&action=delete

build sql 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:

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?|||What happens if you use %43|||I tried:

Server.URLEncode(rsGrades("gradeLetter"))

:cool:

hoping that this would replace any + signs with %43 but it left it a + sign :mad: 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.|||What about the replace function as in...

NewGrade = Replace(rsGrades("gradeLetter"), "+", "%43")|||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.