If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > Data Mismatch

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-26-03, 06:36
rebecca2003 rebecca2003 is offline
Registered User
 
Join Date: Nov 2003
Posts: 3
Data Mismatch

Hi I have created an access database which keeps a record of renting out laptops to people. I use asp to connect to my web pages where the details of name , address etc can be typed in. I have a lend button which allows one to type in the details and then updtae the details to the database. I also have a button that indicates that the laptop is rented out and all I want to do is when one clicks on that button it shows the details of whom the laptop is rented out to. It sounds so simple and I have it almost complete I jsu cant get it to pull up the details. I have tried response. write. Maybe someone can help, please. Thank you.

Here is my page of code. The problem is the sql statement it says there is a data mismatch but I cant see it.

<% @LANGUAGE="VBSCRIPT"%>

<%
Dim dbconn
Dim LaptopID, Lendee, Location, Phone, ltID , rs1, sql, In_Out

' Create and establish data connection
Set dbconn = Server.CreateObject("ADODB.Connection")
dbconn.ConnectionTimeout = 15
dbconn.CommandTimeout = 30

'Use this line to use Access
dbconn.Open "DBQ= "& Server.MapPath("laptops.mdb") & ";Driver={Microsoft Access Driver (*.mdb)};DriverId=25;MaxBufferSize=8192;Threads=20 ;"
%>

<%
' Create recordset and retrieve values using the open connection
Set rs1 = Server.CreateObject("ADODB.Recordset")
' Opening record set with a forward-only cursor (the 0) and in read-only mode (the 1)
rs1.Open "SELECT Lendee, Location, phone, In_Out FROM LaptopDetails Where LaptopID='" & ltID & "'", dbconn
%>

<%
if request.querystring("LaptopID")<>"" then
ltID=request.querystring("LaptopID")
end if

if request.querystring("LaptopID")<>"" then ltID=request.querystring("LaptopID")end if
if Request.querystring("Lendee") <> "" then Lendee=request.querystring("Lendee")end if
if Request.querystring("Location") <> "" then Location=Request.querystring("Location")end if
if Request.querystring("Phone") <> "" then Phone=Request.querystring("Phone") end if
%>

<html>
<body>

<h2>Lend Details</h2>


<p><font color="#FF0000">LaptopID: </font><%Response.write (LaptopID)%>
<p><font color="#FF0000">Name: </font><%Response.write (Lendee)%>
<p><font color="#FF0000">Address: </font><%Response.write (Location)%>
<p><font color="#FF0000">Telephone: </font><%Response.write (Phone)%>




<% dbconn.close %>
Reply With Quote
  #2 (permalink)  
Old 11-26-03, 07:34
fhunth fhunth is offline
Registered User
 
Join Date: Oct 2002
Location: Argentina
Posts: 72
Re: Data Mismatch

i Think you must write the rs values:

Something like this:

Response.write (rs1("Location"))

Hope this helps.






Quote:
Originally posted by rebecca2003
Hi I have created an access database which keeps a record of renting out laptops to people. I use asp to connect to my web pages where the details of name , address etc can be typed in. I have a lend button which allows one to type in the details and then updtae the details to the database. I also have a button that indicates that the laptop is rented out and all I want to do is when one clicks on that button it shows the details of whom the laptop is rented out to. It sounds so simple and I have it almost complete I jsu cant get it to pull up the details. I have tried response. write. Maybe someone can help, please. Thank you.

Here is my page of code. The problem is the sql statement it says there is a data mismatch but I cant see it.

<% @LANGUAGE="VBSCRIPT"%>

<%
Dim dbconn
Dim LaptopID, Lendee, Location, Phone, ltID , rs1, sql, In_Out

' Create and establish data connection
Set dbconn = Server.CreateObject("ADODB.Connection")
dbconn.ConnectionTimeout = 15
dbconn.CommandTimeout = 30

'Use this line to use Access
dbconn.Open "DBQ= "& Server.MapPath("laptops.mdb") & ";Driver={Microsoft Access Driver (*.mdb)};DriverId=25;MaxBufferSize=8192;Threads=20 ;"
%>

<%
' Create recordset and retrieve values using the open connection
Set rs1 = Server.CreateObject("ADODB.Recordset")
' Opening record set with a forward-only cursor (the 0) and in read-only mode (the 1)
rs1.Open "SELECT Lendee, Location, phone, In_Out FROM LaptopDetails Where LaptopID='" & ltID & "'", dbconn
%>

<%
if request.querystring("LaptopID")<>"" then
ltID=request.querystring("LaptopID")
end if

if request.querystring("LaptopID")<>"" then ltID=request.querystring("LaptopID")end if
if Request.querystring("Lendee") <> "" then Lendee=request.querystring("Lendee")end if
if Request.querystring("Location") <> "" then Location=Request.querystring("Location")end if
if Request.querystring("Phone") <> "" then Phone=Request.querystring("Phone") end if
%>

<html>
<body>

<h2>Lend Details</h2>


<p><font color="#FF0000">LaptopID: </font><%Response.write (LaptopID)%>
<p><font color="#FF0000">Name: </font><%Response.write (Lendee)%>
<p><font color="#FF0000">Address: </font><%Response.write (Location)%>
<p><font color="#FF0000">Telephone: </font><%Response.write (Phone)%>




<% dbconn.close %>
Reply With Quote
  #3 (permalink)  
Old 11-26-03, 09:47
rebecca2003 rebecca2003 is offline
Registered User
 
Join Date: Nov 2003
Posts: 3
hi thanks for your help but it still says data mismatch, it has something to do with the ltID and I dont know what. This is the way the code stands at the minute.

rs1.Open "SELECT Lendee, Location, phone, In_Out FROM LaptopDetails where LaptopID ='" & ltID & "'", dbconn


but if I write this

rs1.Open "SELECT Lendee, Location, phone, In_Out FROM LaptopDetails where LaptopID =10"

It brings up the information about laptop 10.
Any Ideas?

Thanks
Reply With Quote
  #4 (permalink)  
Old 11-26-03, 10:16
rebecca2003 rebecca2003 is offline
Registered User
 
Join Date: Nov 2003
Posts: 3
hi there its ok I got the problem sorted I needed to put my if request.querystrings above my select statement.

Thanks
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On