Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Request.QueryString

Status
Not open for further replies.

brentnewbury

Programmer
May 1, 2001
30
GB
Hi I have another problem

I get this error message when running a query:

Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E07)
[Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression.

The query is:

SQLGetMessage1 = "SELECT * FROM " & PrivateMessageTable & " WHERE " & "PostID='" & PostID & "'"

The HTML link is:

<a href=&quot;message_read.asp?PostID=30 %>&quot; name=&quot;PostID&quot;>

The PostID is an AutoNumber (in other words it is an autoincrement number)

So couls anyone tell me what is wrong??

Thnx for your time,
Brent Newbury
 
Sorry I forgot to include the:

Dim PostID
PostID = RequestQueryString(&quot;PostID&quot;)
 
you have said nothing, about the

& privatemessagetable &

if this is not a querystring, then you should actually have

SQLGetMessage1 = &quot;SELECT * FROM PrivateMessageTable WHERE &quot; & &quot;PostID='&quot; & PostID & &quot;'&quot;

at least i believe that is right, works that way for me anyway.

the above is only if PrivateMessageTable is the table name, and not a query variable

 
sorry

shouldnt it actually be

SQLgetmessage1 = &quot;SELECT * FROM Privatemessagetable WHERE PostID=&quot; & CInt( Request.QueryString( &quot;PostID&quot; )&quot;

thanks
 
Sorry I have not explained the problem very well have I.

This is the link I want people to follow:

<a href=&quot;message_read.asp?ID=<% Response.Write(rs1(&quot;PostID&quot;)) %>&quot; name=&quot;PostID&quot;>

The <% Response.Write(rs1(&quot;PostID&quot;) %> is just a number given to each post in the Access Database. Just say 30 for example, so the address would be:

(That is the real link to what I am doing)

When I try and request the querystring on this page, I get this error message:

Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E07)
[Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression.
/message_read.asp, line 22

This is the part in my code that is messing up:

SQLGetMessage1 = &quot;SELECT * FROM &quot; & PrivateMessageTable & &quot; WHERE &quot; & &quot;PostID='&quot; & Request.QueryString(&quot;PostID&quot;) & &quot;'&quot;
Set rsGetMessage1 = Conn.Execute(SQLGetMessage1)

I have also tried the:

SQLGetMessage1 = &quot;SELECT * FROM &quot; & PrivateMessageTable & &quot; WHERE &quot; & &quot;PostID='&quot; & CInt(Request.QueryString(&quot;PostID&quot;)) & &quot;'&quot;
Set rsGetMessage1 = Conn.Execute(SQLGetMessage1)

and neither work. I still get the same error.

So does anyone else have any other idea's???
 
Just a thought....you are enclosing the value
CInt(request.querystring(&quot;postid&quot;)) in ticks this indicates to SQL that it is a string doesn't it?

try this:

SQLGetMessage1=&quot;Select * from &quot;&PrivateMessageTable&&quot;where PostID=&quot;&CInt(request.querystring(&quot;postid&quot;))


hope that helps

Tal McMahon
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top