473,711 Members | 3,005 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ASP link back to Access database

I am having great difficulty in these asp scripts, using VBscript and
JavaScript.

I have 4 files that all need to be linked together.

The first file "Books.html " - needs to search for a Book title, author
or ISBN number from a Access database called "Books.mdb" . When the
user clicks Submit from the "Books.html " file (after inputting info in
a text box and clicking the required box to define Title, Author or
ISBN), the information is then filtered through "Books.asp" file and
"CreateTable.as p" file.

<PLEASE SEE MY FILES and coding below this message, didn't know how to
attach files - files below: Books.asp; Books.inc; Books.html and
CreateTable.asp . Not shown is Books.mdb Access database file.

My problem is this: I cannot get the script in the Books.asp file to
only bring up certain information pertaining to that in my search box
from the "Books.html " file. What happens, is a) I get a error message
when I try and debug it or b) the full table comes up.

HELP !

I am using Abysse web server under http://localhost port8080.

Can anyone please help.. Any feedback most appreciated. My personal
e-mail is ks*****@shaw.ca for any step by step instructions you can
offer.

Thank you so much.

PS - yah, you guessed it, this is a URGENT request too. :)

Expand|Select|Wrap|Line Numbers
  1. "BOOKS.ASP file"
Expand|Select|Wrap|Line Numbers
  1. <HTML>
  2.  
  3. <!--#INCLUDE FILE="Books.inc" -->
  4. <!--#INCLUDE FILE="ADOVBS.inc" -->
  5. <!--#INCLUDE FILE="CreateTable.asp" -->
  6.  
  7. <HEAD>
  8.  
  9. <TITLE>Accessing a Data Store using DSN (Data Source Name) with Active
  10. Server Pages </TITLE>
  11.  
  12. </HEAD>
  13. <BODY>
  14.  
  15. <%
  16. Dim objConn
  17. Dim objRec
  18.  
  19. Dim CheckISBN
  20. Dim CheckTitle
  21. Dim CheckAuthor
  22. Dim SearchString
  23. Dim found
  24.  
  25. objConn.Open strConnect
  26. objRec.Open "Titles",strConnect,adOpenStatic,adLockReadOnly,adCmdTable
  27. objRec.MoveFirst
  28. Response.Write CreateTable(objRec)
  29.  
  30. found=0
  31. CheckISBN=Request.Form("chkISBN")
  32. CheckTitle=Request.Form("chkTitle")
  33. CheckAuthor=Request.Form("chkAuthor")
  34.  
  35. SearchString=Request.Form("txtSearch")
  36.  
  37. Set objConn=Server.CreateObject("ADODB.Connection")
  38. Set objRec=Server.CreateObject("ADODB.RecordSet")
  39.  
  40. objConn.Open strConnect
  41.  
  42. objRec.Open "Titles",strConnect,adOpenStatic,adLockReadOnly,adCmdtable
  43. objRec.MoveFirst
  44.  
  45. If CheckISBN = "ByISBN" Then
  46. objRec.Find "ISBN= '"& Request.Form("txtSearch") & "'"
  47.  
  48. If Not objRec.EOF Then
  49. found=1
  50. Response.Write objRec("ISBN")
  51. Response.Write "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"
  52. Response.Write objRec("Price")
  53. Response.Write "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"
  54. Response.Write objRec("Title") & "<BR>"
  55. End if
  56. End if
  57.  
  58. If CheckTitle = "ByTitle" Then
  59. objRec.Find "Title= '"& Request.Form("txtSearch") & "'"
  60.  
  61. If Not objRec.EOF Then
  62. found=1
  63. Response.Write objRec("ISBN")
  64. Response.Write "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"
  65. Response.Write objRec("Price")
  66. Response.Write "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"
  67. Response.Write objRec("Title") & "<BR>"
  68. End if
  69. End if
  70.  
  71. If CheckAuthor = "ByAuthor" Then
  72. objRec.Filter = "Author= '"& Request.Form("txtSearch") & "'"
  73.  
  74. While Not objRec.EOF
  75. If objRec("Author") = SearchString Then
  76. found=1
  77. Response.Write objRec("ISBN")
  78. Response.Write "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"
  79. Response.Write objRec("Price")
  80. Response.Write "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"
  81. Response.Write objRec("Title") & "<BR>"
  82. End if
  83.  
  84. objRec.MoveNext
  85. Wend
  86. If found=0 Then
  87. Response.Write "Record Not Found"
  88. End if
  89. End if
  90.  
  91. objRec.Close
  92. objConn.Close
  93. Set objRec=Nothing
  94. Set objConn=Nothing
  95.  
  96.  
  97. </BODY>
  98. </HTML>
  99.  
Expand|Select|Wrap|Line Numbers
  1. BOOKS.INC file
Expand|Select|Wrap|Line Numbers
  1. <HTML>
  2.  
  3. <HEAD>
  4.  
  5. <TITLE>Location specific records in a database, with DSN and Active
  6. Server Pages </TITLE>
  7.  
  8. </HEAD>
  9.  
  10. <BODY>
  11.  
  12. <%
  13. strConnect = "Driver={Microsoft Access Driver
  14. (*.mdb)};DBQ=c:\inetpub\wwwroot\K_Orman\Books.mdb;"
  15. %>
  16.  
  17. </BODY>
  18. </HTML>
  19.  
Expand|Select|Wrap|Line Numbers
  1. BOOKS.HTML file
<HTML>

<HEAD>

<TITLE> Location Specifc Records - Active Server Pages, Connecting to
DSN - PART 3</TITLE>

</HEAD>

<BODY>

<FORM NAME="frmsearch " ACTION="Books.a sp" METHOD="Post">

<H3> Please enter the Title, the Author, or the ISBN number of the
book(s) you wish to search for: </H3>

<INPUT TYPE="text" NAME="txtSearch "><BR>

Search by: <BR>

<INPUT TYPE="checkbox" NAME="chkTitle" VALUE="ByTitle" > Title <BR>
<INPUT TYPE="checkbox" NAME="chkAuthor " VALUE="ByAuthor "> Author <BR>
<INPUT TYPE="checkbox" NAME="chkISBN" VALUE="ByISBN"> ISBN
<BR><BR><BR>
<INPUT TYPE="submit" NAME="cmdSearch " VALUE="Search"> <BR>
<INPUT TYPE="Reset" NAME="cmdreset" VALUE="Reset">
</FORM>

</BODY>
</HTML>
[/code]

Expand|Select|Wrap|Line Numbers
  1. CREATETABLE.asp file
Expand|Select|Wrap|Line Numbers
  1. <HTML>
  2.  
  3. <HEAD>
  4.  
  5. <TITLE> Active Server Pages - Data Name Source </TITLE>
  6.  
  7. </HEAD>
  8.  
  9. <BODY>
  10.  
  11. <%
  12. Function CreateTable(objRecordset)
  13.  
  14. Dim fldField
  15. Dim strTable
  16.  
  17. strTable = "<TABLE BORDER=2>" & "<TR ALIGN=CENTER>"
  18.  
  19. For Each fldField in objRecordset.Fields
  20. strTable = strTable & "<TD>" & fldField.Name & "</TD>"
  21. Next
  22.  
  23. strTable = strTable & "</TR>"
  24.  
  25. While not objRecordset.EOF
  26. strTable = strTable & "<TR ALIGN=CENTER>"
  27.  
  28. For Each fldField in objRecordset.Fields
  29. strTable= strTable & "<TD>" & fldField.Value & "</TD>"
  30. Next
  31.  
  32. strTable= strTable & "</TR>"
  33. objRecordset.MoveNext
  34.  
  35. Wend
  36.  
  37. strTable = strTable & "</TABLE>"
  38.  
  39. CreateTable = strTable
  40.  
  41. End Function
  42.  
  43. %>
  44.  
  45. </BODY>
  46. </HTML>
  47.  
[/quote][/code] THANK YOU SO MUCH.....
Jul 23 '05 #1
3 1931
In article <fa************ **************@ posting.google. com>,
ks*****@shaw.ca enlightened us with...
I am having great difficulty in these asp scripts, using VBscript and
JavaScript.

I didn't see any javascript.
But, I'm pretty okey-dokey with VBScript, so...
I have 4 files that all need to be linked together.

My problem is this: I cannot get the script in the Books.asp file to
only bring up certain information pertaining to that in my search box
from the "Books.html " file. What happens, is a) I get a error message
when I try and debug it or b) the full table comes up.

HELP !

My guess is that you're not getting the search string you think you are.
CheckISBN=Reque st.Form("chkISB N")
CheckTitle=Requ est.Form("chkTi tle")
CheckAuthor=Req uest.Form("chkA uthor")

Write these to output with a Request.Write and end the page there (test
page if you want).
I bet they don't match

If CheckISBN = "ByISBN" Then


that sort of thing.

I bet you get a one or a true. That is, CheckISBN will either be "1" or
"true" which would completely mess up your query and cause the selection
of all records.
Checkboxes get passed as true/false, I think...
like chkISBN=true in the query string.

Just change the method of the form to get and look at the URL to see if
you don't want to write the stuff on the page.

--
--
~kaeli~
Never mess up an apology with an excuse.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 23 '05 #2
Thanks Kaeli,

You probably guessed that I'm new at this vbscripting code thing - so
would you please reply with the correct code to the specific file that
needs it. Or send me a e-mail.

I'm a bit lost in your reply.

Thanks.
*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 23 '05 #3
In article <40************ **********@news .newsgroups.ws> ,
ks*****@shaw.ca enlightened us with...
Thanks Kaeli,

You probably guessed that I'm new at this vbscripting code thing - so
would you please reply with the correct code to the specific file that
needs it. Or send me a e-mail.

I'm a bit lost in your reply.


Okay, I did a little check. My idea was not what was causing the
problem. But it was something similar.
Your search string is empty. For some reason,
SearchString=Re quest.Form("txt Search")
is returning a blank. I don't know why, since it shows in the URL when I
do a GET and from POST when I loop through all form elements (see test
file).

This smacks of a school assignment, so you may want to ask your teacher.
The following is a test I did to see what the form was submitting. Run
it and you'll see what's wrong. I don't know if it's a server thing or
what. I've never seen this problem with unencoded forms. I gotta go home
now, so you won't see a reply from me 'til Monday.

test.asp
<HTML>
<HEAD>
<TITLE> Location Specifc Records - Active Server Pages, Connecting to
DSN - PART 3</TITLE>
</HEAD>
<BODY>
<FORM NAME="frmsearch " ACTION="test1.a sp" METHOD="post">
<H3> Please enter the Title, the Author, or the ISBN number of the
book(s) you wish to search for: </H3>
<INPUT TYPE="text" NAME="txtSearch "><BR>
Search by: <BR>
<INPUT TYPE="checkbox" NAME="chkTitle" VALUE="ByTitle" > Title <BR>
<INPUT TYPE="checkbox" NAME="chkAuthor " VALUE="ByAuthor "> Author <BR>
<INPUT TYPE="checkbox" NAME="chkISBN" VALUE="ByISBN"> ISBN
<BR><BR><BR>
<INPUT TYPE="submit" NAME="cmdSearch " VALUE="Search"> <BR>
<INPUT TYPE="Reset" NAME="cmdreset" VALUE="Reset">
</FORM>
</BODY>
</HTML>

test1.asp
<%@ Language=VBScri pt %>
<html>
<head>
<title>Untitl ed Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<p>This is a test page for the form submit values.</p>
<p>
CheckISBN=<%= Request.Form("c hkISBN") %>
CheckTitle=<%= Request.Form("c hkTitle") %>
CheckAuthor=<%= Request.Form("c hkAuthor") %>
SearchString=<% Request.Form("t xtSearch") %>
</p>
<%
Dim f
For Each f In Request.Form
Response.Write f & " = "
Response.Write Request.Form(f) & "<br>"
Next
%>
</body>
</html>
--
--
~kaeli~
Can you be a closet claustrophobic?
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 23 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
3303
by: Scott Tilton | last post by:
I am having a terrible time getting this to work. I am hoping someone out there can help me with very specific code examples. I am trying to get the linked tables in my Access 97 database to be updated whenever the database opens. I need to have them updated based on an INI file that resides in the same directory as the current database. I do not need or want the ability to open a dialog box to pick the location. I simply want it to...
2
2141
by: jaYPee | last post by:
i have split my database and created a code that will look up for the location of the mdb back end everytime the front end link has change. i'm wondering if there is a way to just create and INI file to store the location of database backend. 'cause it's very time consuming sometimes when u change the front end (i.e. the query, forms, reports, etc) from other computer and when u update the mdb files from other machine it will look up again...
4
1821
by: Ove | last post by:
I have one Access 2000 DB on my website. I want to access these tables from my local database so i do not need to down-/upload the database each time i want to make changes. Meanwhile i want a external partner to access (just read) another database on my web. I have tried with "link tables" but do not succeed. Help please! /Ove H,
3
2171
by: debbie | last post by:
I have an Access 2002 program that I install using Wise. The first thing my program does when a front end is opened is re-link, then it checks the version and if needed upgrades the backend. My problem is that I have a new front end version upgrade that creates several new tables in the backend and then links them. So when the program opens up it checks the version in the backend and if needed creates new tables & new links. Now when...
18
1854
by: Bruce Lawrence | last post by:
We use Access 97. We are in the process of migrating to 2003 along with SQL in most cases. We have a production database that contains a pretty important table and we would like to know which other databases on our network link to this table. The reason is because we plan to add/remove certain fields in this table when we put it in SQL but we would like to know ahead of time which databases will be affected by this. I seem to...
0
2573
by: RLN | last post by:
I have a Microsoft Access2002 database that needs to connect to an Oracle Database. I need to map 2 tables from the Oracle DB to retrieve the proper data. I read somewhere (quite a while back) that if you use ADO in Access, you can connect without the need for ODBC, TNSNAMES.ORA and the Oracle client installed on the user's desktop. If I use the Microsoft driver for Oracle, is it possible to connect to an Oracle DB using straight VBA
7
4082
by: Lisa | last post by:
I have an Access 2000 application that uses the following function to re-link my tables when I switch from my Current back end to a Dummy back end. I also use it to refresh my links. Function CreateODBCLinkedTables() As Boolean On Error GoTo CreateODBCLinkedTables_Err Dim strTblName As String, strConn As String Dim db As DataBase, rs As Recordset, tbl As TableDef Dim DatabaseName As String Dim ServerName As String
10
6763
richardhodge
by: richardhodge | last post by:
I am a VB6 database programmer and have run into a small problem. The company I work for primarily uses Microsoft Access 2000 for the database that is the back end for our software. Well the functionality that I am currently working on creates a table in one database and then links it into the primary database that is used by the program to store and retrieve data from. Here's the problem. I can create the table fine but when I go to link the...
7
2951
by: ApexData | last post by:
Hello I currently Link the FE/BE using the LinkTables Option and the Linked Table Manager. Any time I need to move the BE to another location, I have to go through this process over again. I need the flexibility of being able to move the BE data to wherever I want, without manually going through this process. I just want to change the Path/Filename that I keep in a FE Table. I want to be able to place a Path/Filename in a FE Table...
8
3040
by: Neil | last post by:
I just started using Access 2003, and I can't link a SQL Server table. I right-click on the database window; select Link Tables; and select ODBC Databases from the Files of Type dropdown. As soon as I select ODBC Databases from the Files of Type dropdown, the entire dialog box disappears. No error message. Just disappears, and I'm back at the database window. I have tried this with other databases, including a brand new blank one, and...
0
8794
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8699
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9295
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9005
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7935
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6617
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5942
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4713
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2509
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.