PDA

Click to See Complete Forum and Search --> : Request.Querystring question


HakanAzaklioglu
Jun 6th, 2000, 11:55 PM
I am trying to pass a variable over via the request.querystring command...

Here is a sample of my code:

<%Do Until rsDESKTOP.EOF%>
<tr>
<td width="351" align="left" bgcolor="#FFFFFF"><span style="text-transform: uppercase"><font face="Arial" size="1"><%response.write rsDESKTOP("Blurb")%></font></span></td>
<td width="212" align="right" bgcolor="#FFFFFF"><font face="Arial" size="1"><span style="text-transform: uppercase"><a href="system.asp?SystemId=<%response.write rsDESKTOP("BELONG")%>"><%response.write rsDESKTOP("Description")%></a></span>*</font></td>
</tr>
<%rsDESKTOP.MoveNext
loop
%>


What this sniplet does is reference a database and populates a page with the items from my database and also assigns a value to the href.

that value is being populated from the same database that the next page is calling... but I am getting the error message

Microsoft OLE DB Provider for ODBC Drivers error '80040e10'

[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 2.

/tvi/system.asp, line 9


before i was getting a "Expected 1" i don't quite understand why it now shows 2.

And below is the code for the second page that recieves the variable via the url.

<%
set rsSYSTEM = conn.Execute("Select * from TVISYSTEMS where SysID = " _
& Request.QueryString("SystemId"))
%>


If I change the value of the system being passed back and forth through the two pages from a single letter to a single number without changing any code... it works... why??

Kind Regards,
Hakan

dvst8
Jun 7th, 2000, 12:59 AM
in the href you seem to be trying to pass two parameters. the first one is systemID = rsDESKTOP("BELONG"), but then before you close the </a> you have rsDESKTOP("Description").
What this second thing doing in there? do you want to pass it as a parameter as well?? if so then you will have to seperate them with an '&' symbol.
try this:

<a href="system.asp?SystemId=<%=rsDESKTOP("BELONG")%>&desc=<%=rsDESKTOP("Description")%>"></a>

HakanAzaklioglu
Jun 7th, 2000, 01:09 AM
The first variable is the value, the system id, and the second value is the text description that you see as the clickable url on the page

The second value does not get passed along it is just the viewable text representation of the url's value

It is kind wierd... Like I said it all works fine if I am using numbers... like 1-10 but if I switch to Letters A-J it fails...

The only reason I switched to letters as a sort of index was because I had 10 systems and when I did a search through my db column any system that had a "1" OR a "10" came up together...

That is the reason for switching to letters...

Thanks for the suggestion... I'll try working with the section of the code...

Kind Regards,
Hakan

PS
I just tried it... it didn't seem to change anything as far as the end result that is...

dvst8
Jun 7th, 2000, 01:33 AM
oh i see.. sorry.
hmm that is weird.

i will think it about it.

HakanAzaklioglu
Jun 7th, 2000, 02:20 AM
One other thing that I have noticed is that if I go to my access database and switch my main column from text to number it works just fine

If I leave it as text and actually have numbers as the data in the column it does not work... switch it back to number and it works... it seems to be more of an access 2000 problem maybe...

I hope this provides some insight on my situation...

Kind Regards,
Hakan

Clunietp
Jun 7th, 2000, 09:51 AM
there is a slight problem with your SQL statement....when you search on text fields, you must wrap your parameter within single quotes:

change this:
set rsSYSTEM = conn.Execute("Select * from TVISYSTEMS where SysID = " _
& Request.QueryString("SystemId"))

to this:
set rsSYSTEM = conn.Execute("Select * from TVISYSTEMS where SysID = '" _
& Request.QueryString("SystemId")) & "'"


Tom

HakanAzaklioglu
Jun 7th, 2000, 08:37 PM
Ok... that seemed to accomplish something... I have moved on to yet another error message after making the suggested change...

Here is the error message:
===========================================================
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[Microsoft][ODBC Microsoft Access Driver] Syntax error in string in query expression 'SysID = 'E'.

/tvi/system.asp, line 9
===========================================================

And on Line 9 we find the following:
===========================================================
(line 08) <%
(line 09) set rsSYSTEM = conn.Execute("Select * from TVISYSTEMS where SysID = '" _
(line 10) & Request.QueryString("SystemId")) & "'"
(line 11) %>
===========================================================

Thank You for your help...

Kind Regards,
Hakan

[Edited by HakanAzaklioglu on 06-08-2000 at 09:54 AM]

HakanAzaklioglu
Jun 8th, 2000, 02:34 AM
Could it have anything to do with what I mentioned earlier on this thread about how if I changed my access database to show the column as a number that everything worked fine... but if I changed it to text that it would fail... even if there was a number in the text column...

Clunietp
Jun 8th, 2000, 10:34 PM
your SQL looks fine, I don't know why you're getting an error...

If you want to send me your database and ASP page, i'll throw it on my web server and see if I can find the problem when I have time


Tom
Clunietp@yahoo.com

HakanAzaklioglu
Jun 11th, 2000, 10:42 PM
That is something I would have to clear with my managers... Um... let me think of that as a last resort... And I am a little leary about burdening you with my problems...

Does anyone else have any ideas on this...

Kind Regards,
Hakan

Clunietp
Jun 12th, 2000, 04:31 AM
Try using the native OLEDB provider, like I said, your SQL looks fine...possibly something with the driver....

if you don't know what I'm talking about, post your connection string here and we'll adjust it....

If I thought helping people was a "burden", I would not spend countless hours here answering questions

Tom

HakanAzaklioglu
Jun 12th, 2000, 07:59 PM
Here is the connection string as requested...

<%
set conn = server.createobject ("adodb.connection")
conn.open "TESTDB"
%>

Thanks...

PS
Please don't misunderstand. I didn't mean helping people was a burden. What I meant is that I am sure you have a busy schedule and I didn't want to burden your work or free time...

Kind Regards,
Hakan

Clunietp
Jun 12th, 2000, 11:19 PM
Hi Hakan

What is TESTDB? is that a DSN or something?

I have enough time to help other people, don't worry about me :)

HakanAzaklioglu
Jun 12th, 2000, 11:28 PM
Yes... TESTDB is the dsn...

Quick question what is the difference between:

===========================================
Driver do Microsoft Access [*.mdb]

and

Microsoft Access Driver [*.mdb]
===========================================

both are version 4.00.4403.02

Different language driver??

HakanAzaklioglu
Jun 13th, 2000, 01:08 AM
I think i might be making some progress... would anybody happen to know what this error message means:

ADODB.Field error '80020009'

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

/tvi/system.asp, line 0


Kind Regards,
Hakan

Clunietp
Jun 13th, 2000, 02:20 PM
ok, that means that your query process successfully (hooray!), but you have to check for rsSYSTEM.EOF before you try to modify the record...

actually, because you are using the Connection.Execute method, you will not be able to modify the resulting recordset. Conn.Execute returns a read only, forward only recordset. You need to use a Recordset.Open method to modify any records (if that is what you are doing)

Tom

HakanAzaklioglu
Jun 13th, 2000, 08:48 PM
Well I have set my second page to recieve the variable from the first page again... just like you specified earlier and I am not recieving another error message...

I think I will send you my setup via email after all... I think it will save you me some time...

Thanks in Advance,
Hakan Azaklioglu