Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
mastajbl
Starting Member
42 Posts |
Posted - 2009-04-27 : 10:41:42
|
I know this is a SQL forum, but the help provided here is the best I have come acrossed so I figured maybe someone here could help.I am getting an "Unterminated String Constant" during my login redirect script. I have tried several different combinations and usually receive a syntax error when i do that. It is saying this error is occuringMicrosoft VBScript compilation error '800a0409' Unterminated string constant /jblproduction/loginauth2BU.asp, line 30MM_redirectLoginSuccess = "<%=(RS_Login.Fields.Item(Link).Value)----------------------------------------------------------------^Here is my code, if you have any ideas what I am missing I would appreciate the help.1 <%@LANGUAGE="VBSCRIPT"%>2 <!--#include virtual="/DCG/Connections/catalog.asp" -->3 <%4 Dim RS_Login5 Dim RS_Login_cmd6 Dim RS_Login_numRows78 Set RS_Login_cmd = Server.CreateObject ("ADODB.Command")9 RS_Login_cmd.ActiveConnection = MM_catalog_STRING10 RS_Login_cmd.CommandText = "SELECT Link FROM login" 11 RS_Login_cmd.Prepared = true1213 Set RS_Login = RS_Login_cmd.Execute14 RS_Login_numRows = 015 %>16 <%17 ' *** Validate request to log in to this site.18 MM_LoginAction = Request.ServerVariables("URL")19 If Request.QueryString <> "" Then MM_LoginAction = MM_LoginAction + "?" + Server.HTMLEncode(Request.QueryString)20 MM_valUsername = CStr(Request.Form("userId"))21 If MM_valUsername <> "" Then22 Dim MM_fldUserAuthorization23 Dim MM_redirectLoginSuccess24 Dim MM_redirectLoginFailed25 Dim MM_loginSQL26 Dim MM_rsUser27 Dim MM_rsUser_cmd28 29 MM_fldUserAuthorization = "Access"30 MM_redirectLoginSuccess = "<%=(RS_Login.Fields.Item(Link).Value)%>"31 32 MM_redirectLoginFailed = "jblcontact.html"33 MM_loginSQL = "SELECT UserID, Password"34 If MM_fldUserAuthorization <> "" Then MM_loginSQL = MM_loginSQL & "," & MM_fldUserAuthorization35 MM_loginSQL = MM_loginSQL & " FROM login WHERE UserID = ? AND Password = ?"36 Set MM_rsUser_cmd = Server.CreateObject ("ADODB.Command")37 MM_rsUser_cmd.ActiveConnection = MM_catalog_STRING38 MM_rsUser_cmd.CommandText = MM_loginSQL39 MM_rsUser_cmd.Parameters.Append MM_rsUser_cmd.CreateParameter("param1", 200, 1, 50, MM_valUsername) ' adVarChar40 MM_rsUser_cmd.Parameters.Append MM_rsUser_cmd.CreateParameter("param2", 200, 1, 50, Request.Form("Password")) ' adVarChar41 MM_rsUser_cmd.Prepared = true42 Set MM_rsUser = MM_rsUser_cmd.Execute43 If Not MM_rsUser.EOF Or Not MM_rsUser.BOF Then 44 ' username and password match - this is a valid user45 Session("MM_Username") = MM_valUsername46 If (MM_fldUserAuthorization <> "") Then47 Session("MM_UserAuthorization") = CStr(MM_rsUser.Fields.Item(MM_fldUserAuthorization).Value)48 Else49 Session("MM_UserAuthorization") = ""50 End If51 if CStr(Request.QueryString("accessdenied")) <> "" And false Then52 MM_redirectLoginSuccess = Request.QueryString("accessdenied")53 End If54 MM_rsUser.Close57 Response.Redirect(MM_redirectLoginSuccess)58 End If59 MM_rsUser.Close60 Response.Redirect(MM_redirectLoginFailed)61 End If62 %> |
|
|
whitefang
Enterprise-Level Plonker Who's Not Wrong
272 Posts |
Posted - 2009-04-27 : 11:34:19
|
| MM_redirectLoginSuccess = "<%=(RS_Login.Fields.Item(Link).Value)%>"the Value property is returning a extra " which causes an exception. You need to escape it by doing a replace on " with "". I think it's RS_Login.Fields.Item(Link).Value.replace(""",""""); |
 |
|
|
mastajbl
Starting Member
42 Posts |
Posted - 2009-04-27 : 12:04:55
|
| Microsoft VBScript compilation error '800a0401' Expected end of statement /jblproduction/loginauth2BU.asp, line 30 MM_redirectLoginSuccess = "<%=(RS_Login.Fields.Item(Link).Value.replace(""","""");--------------------------------------------------------------------------^[CODE]MM_redirectLoginSuccess = "<%=(RS_Login.Fields.Item(Link).Value.replace(""","""");%>"[/CODE]****EditForgot to double quotes. Now receiving this which isnt adding up to me.Microsoft VBScript compilation error '800a0408' Invalid character /jblproduction/loginauth2BU.asp, line 30 MM_redirectLoginSuccess = ""<%=(RS_Login.Fields.Item(Link).Value.replace(""","""");------------------------------^ |
 |
|
|
whitefang
Enterprise-Level Plonker Who's Not Wrong
272 Posts |
Posted - 2009-04-27 : 12:15:29
|
| MM_redirectLoginSuccess = ""<%=(RS_Login.Fields.Item(Link).Value.replace(""","""");You have double quotes outside, it's incorrect. Should be:MM_redirectLoginSuccess = "<%=(RS_Login.Fields.Item(Link).Value.replace(""","""")%>"Also, why don't you do it this way:MM_redirectLoginSuccess = RS_Login.Fields.Item(Link).Value ????? |
 |
|
|
mastajbl
Starting Member
42 Posts |
Posted - 2009-04-27 : 12:41:21
|
| To ur first reply, MM_redirectLoginSuccess = "<%=(RS_Login.Fields.Item(Link).Value.replace(""","""")%>" I receive an "Unexpected Character" error for the , between the (""","""")For the second one, it would be like this RS_Login.Fields.Item("Link").Value, and I receive this error. I tried to go the route of the lesser of two evils...Microsoft VBScript runtime error '800a000d' Type mismatch: 'Response.Redirect' /jblproduction/loginauth2BU.asp, line 57Dropping the quotes around ("link") i receive this error..ADODB.Fields error '800a0cc1' Item cannot be found in the collection corresponding to the requested name or ordinal. /jblproduction/loginauth2BU.asp, line 30 |
 |
|
|
mastajbl
Starting Member
42 Posts |
Posted - 2009-04-27 : 14:33:05
|
| OK I fixed the issue with the RS_Login.Fields.Item("Link").Value with your help, but it only uses the first field in link column. I have another issue though that has arrived so i will start a new topic for that.Thanks for your help on this one!! |
 |
|
|
|
|
|
|
|