Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

How to get a "WHERE something='Request.Cookies( something)'" to work

Guest
Jul 23, 2011 Jul 23, 2011

Dreamweaver CS4

Page Type is ASP JavaScript.

Code:

<%

var Recordset1_cmd = Server.CreateObject ("ADODB.Command");

Recordset1_cmd.ActiveConnection = MM_iesinvest1_STRING;

Recordset1_cmd.CommandText = "SELECT subscriber_id, clientmoney, stkcomm, optcomm, stkprmin, stkprmax, divyield, clientpe, hilo, spread, minoptpr, minoptvol, minopenint, retcalled, expdate, clientoptmo, contcomm, retsame FROM ClientOTMData WHERE subscriber_id='Request.Cookies(subid)'";

Recordset1_cmd.Prepared = true;

var Recordset1 = Recordset1_cmd.Execute();

var Recordset1_numRows = 0;

%>

Whatever is put into the “WHERE subscriber_id=” doesn’t work. Have tried:

            Request.Cookies(subid) with and without ‘ or “

            $subid with or without ‘ or “

            $_POST(subid) with or without ‘ or “

            @@ subid @@ with or without ‘ or “

            Subid.value with or without ‘ or “

            And these and many others with or without ( )

Error Codes are varied depending on choice above:

     Adobe.field error '800a0bcd'

     Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.

     Missing ';" which is there

     And many more

If any real subscriber_id is typed into the code, like ‘johndoe’ it works.

Have also placed a docutmnt.write script on the page and it shows the cookie.

Have also placed a field with ‘Request.Cookie on the pageand it shows the cookie.

So the cookies is available on the page.

Is there anything that will work in this Recordset command?

Any help is appreciated.

TOPICS
Server side applications
557
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 23, 2011 Jul 23, 2011

You are not forming your string properly. You are embedding dynamic content inside single quotes, so it will be evaluated as a string and not as the cookie value. Try this:

Recordset1_cmd.CommandText = "SELECT subscriber_id, clientmoney,  stkcomm, optcomm, stkprmin, stkprmax, divyield, clientpe, hilo, spread,  minoptpr, minoptvol, minopenint, retcalled, expdate, clientoptmo,  contcomm, retsame FROM ClientOTMData WHERE  subscriber_id=" + Request.Cookies(subid);

Also, why are you using ASP/Javascript rather than VBSCRIPT?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jul 25, 2011 Jul 25, 2011

bregent,

Thanks for the reply. I tried it but still get:

Microsoft JScript runtime error '800a1391'

'subid' is undefined

/AnalyzerInputOTM.asp, line 161

but it is defined.

I was able to get everything working on my site over the weekend by reverting back to my old FrontPage and JavaScript pages that I have been using for 12 years. I recently changed hosts (for the first time since 1996 and they suggested converting to MySQL and .php which I started using Dreamweaver. I guess I just don't understand Dreamweaver yet, but I have taken most of the tutorials and even bought the "Dummies" book. I will continue to try to convert the site over but must keep my subscribers happy. I have several complicated queries that were developed in Access back in 1999 that may not convert over to MySQL but I will press on.

Carl "Buss" Van Hecke

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 25, 2011 Jul 25, 2011
LATEST

The cookie id needs to be quoted; it's not a local variable. Try this:

Recordset1_cmd.CommandText = "SELECT subscriber_id, clientmoney,   stkcomm, optcomm, stkprmin, stkprmax, divyield, clientpe, hilo, spread,   minoptpr, minoptvol, minopenint, retcalled, expdate, clientoptmo,   contcomm, retsame FROM ClientOTMData WHERE  subscriber_id=" +  Request.Cookies("subid");

>I guess I just don't understand Dreamweaver yet

There really isn't much to understand about Dreamweaver if you already know HTML and CSS. It's just an application for managing web pages. If you've let FrontPage create all of your dynamic pages and have used FP extensions, then you will need to learn ASP/Javascript. But, it's also not a bad idea to start to learn PHP and migrate over as time permits.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines