Hey Guys!

I am having trouble getting my insert and login pages to work and I wondering if any of you had any ideas?? please!!! I need to get this working asap!

I have followed directions to get the login page to work and used user authentication server behaviour. When I try to test this in my browser it lets me enter a username and password and when I click the login button it says 'do you want password manager to remember this login?' I click no and instead of logging me it says 'this page can not be displayed' but I can view the page its supposed to direct me to in the browser so its not a problem with the next page.

I have also followed instructions to create an insert page and a user registration page, neither of the insert record server behaviours will work, the same this happens, it says ' this page cannot be displayed' and nothing is insterted into the database... I dont understand why!

Another problem I am having is that i have created a search recordset that searches for a product ID and displays the results, this works when I test the recordset in Dreamweaver but not when i try to test it in the browser!

Some of my pages seem to work in the browser while others dont.

Any ideas would be greatly appreciated! Thank you!!!! :)

GLT

Recommended Answers

All 30 Replies

I noticed on the 'this page cannot be displayed' page that there was a line telling me which line of code held the error. On all 3 pages that i have created that use a record set have the same error which seems to be in the code for the record set:-

<%
Dim Recordset1
Dim Recordset1_numRows

Set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveConnection = MM_dbtest_STRING
Recordset1.Source = "SELECT * FROM product WHERE ProductID = " + Replace(Recordset1__MMColParam, "'", "''") + " ORDER BY ProductID ASC"
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 1
Recordset1.Open()

Recordset1_numRows = 0
%>

the highlighted line is the line my browser is telling me the error is. each error for each page points out the same line. I dont understand why there would be an error here as Dreamweaver creates this code itself when the recordset is created.

any ideas would be greatly appreciated!!!!!

Thanks guys!

GLT

is MM_dbtest_STRING declared, and set? Sounds like it isn't.

i dont know! i'm a bit of a newbi.
i just created the recordset, didnt know i was to do anything else. what do i have to do??

Thanks for your reply!!

GLT

You need a connection in order to use the recordset:

Dim MM_dbtest_STRING
Set MM_dbtest_STRING = Server.CreateObject("ADODB.Connection")
MM_dbtest_STRING.Provider = "Connectionstringhere"

Get a connectionstring at http://www.connectionstrings.com/

it keeps saying error line 15 column 4 - this corresponds with the _STRING part of the first line.

Where abouts in the code should I place this??

heres my code for the whole page so far:-

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include file="Connections/dbtest.asp" -->

<%
Dim search__MMColParam
search__MMColParam = "1"
If (Request.Form("ProductID") <> "") Then
search__MMColParam = Request.Form("ProductID")
End If
%>
<%
Dim search
Dim search_numRows

Set search = Server.CreateObject("ADODB.Recordset")
search.ActiveConnection = MM_dbtest_STRING
search.Source = "SELECT * FROM product WHERE ProductID = " + Replace(search__MMColParam, "'", "''") + " ORDER BY ProductID ASC"
search.CursorType = 0
search.CursorLocation = 2
search.LockType = 1
search.Open()

search_numRows = 0%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>search</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>Insert product ID you wish to search for:-
<form action="<%=MM_editAction%>" method="POST" name="formsearch" id="formsearch">
<table width="528" height="136" border="1">
<tr>
<td width="153">productID</td>
<td width="359"><input name="txtProductID" type="text" id="txtProductID" size="50"></td>
<td><input name="btnsearch" type="submit" id="btnsearch" value="search"></td>
</tr>
</table>

<input type="hidden" name="MM_search" value="formsearch">
</form>
<p> </p>
<table width="456" height="100" border="1">
<tr>
<td width="220">ProductID</td>
<td width="220"><%=(search.Fields.Item("ProductID").Value)%></td>
</tr>
<tr>
<td>Product</td>
<td><%=(search.Fields.Item("Product").Value)%></td>
</tr>
<tr>
<td>Price</td>
<td><%=(search.Fields.Item("Price").Value)%></td>
</tr>
</table>

</body>
</html>
<%
search.Close()
Set search = Nothing
%>

highlighted is the recordset part.

Maybe there is one single quote to many , try this

search.Source = "SELECT * FROM product WHERE ProductID = " + Replace(search__MMColParam, " ' ", " ' ")

Hi!

Thanks for replying.

I tried what you said and it still didnt work.
Here is what the error page says:-

The page cannot be displayed
There is a problem with the page you are trying to reach and it cannot be displayed.

Please try the following:

* Click the Refresh button, or try again later.
* Open the localhost home page, and then look for links to the information you want.

HTTP 500.100 - Internal Server Error - ASP error
Internet Information Services

Technical Information (for support personnel)

* Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Microsoft][ODBC Microsoft Access Driver] The Microsoft Jet database engine cannot open the file '(unknown)'. It is already opened exclusively by another user, or you need permission to view its data.
/testlogin/search.asp, line 16

* Browser Type:
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.7.12) Gecko/20050919 Firefox/1.0.7

* Page:
GET /testlogin/search.asp

* Time:
giovedì 6 marzo 2008, 10.02.44

* More information:
Microsoft Support

Any other ideas would be greatly appreciated!
Thanks guys! :)

GLT

I looked closely at this line (which isnt the original error line - its the next line down - the one ToobeK said to change):-

search.Source = "SELECT * FROM product WHERE ProductID = " + Replace(search__MMColParam, "'", "''") + " ORDER BY ProductID ASC"

and noticed that the quote marks before SELECT where not closed. I am not sure if this needs to be but as I have done a lot of coding in Java before which needs the quote marks closed I decided to put quote marks at the end of the line. so the line of code now looks like this:-

search.Source = "SELECT * FROM product WHERE ProductID = " + Replace(search__MMColParam, "'", "''") + " ORDER BY ProductID ASC""

I then tried to test the page on my browser and I got a different error message:-

Technical Information (for support personnel)

* Error Type:
Microsoft VBScript compilation (0x800A0409)
Unterminated string constant
/testlogin/search.asp, line 17, column 128
search.Source = "SELECT * FROM product WHERE ProductID = " + Replace(search__MMColParam, "'", "''") + " ORDER BY ProductID ASC""

The error message is now for this line not the original one!

anyone any ideas????

Thanks!!

GLT

You need a connection in order to use the recordset:

Dim MM_dbtest_STRING
Set MM_dbtest_STRING = Server.CreateObject("ADODB.Connection")
MM_dbtest_STRING.Provider = "Connectionstringhere"

Get a connectionstring at http://www.connectionstrings.com/

I have tried all sorts of combinations, none seem to work, they all return the same error:-

Error Type:
Microsoft VBScript compilation (0x800A0411)
Name redefined
/testlogin/search.asp, line 14, column 4
Dim MM_dbtest_STRING

Doesnt seem to like the first line Dim MM_dbtest_STRING

do you think maybe it doesnt like the STRING part???? Dreamweave coded this so I dont understand why it would be wrong!???

(sorry Ive been writing so many replys... ive been trying everything!)

Thanks!
GLT :)

So change MM_dbtest_STRING to "conn"

WHenever dreamweaver codes something, like MM*, it creates a separate file to read off the data within it. Search for a file with MM in it, and then you can look within that file.

Let's stay at the ' and "" for a while. Putting those in wrong order or number is very common.
I don't use dreamviewer so I can't say how that works.

What I can see you are not closing the ". There is one doublequote to many at line 17,column 128.

Error message:
Microsoft VBScript compilation (0x800A0409)
Unterminated string constant
/testlogin/search.asp, line 17, column 128


What I can see you are trying to replace single quotes with double single quotes in strings that comes with the variable search__MMColParam, Correct ?

I have separated the parts of the query into lines for easier reading, AND I put the replace function into a new variable, SM. Don't forget to declare that: Dim SM

Try this:

SM = Replace(search__MMColParam, "'","''" )

search.Source = "SELECT * FROM product " &_
"WHERE ProductID = '" & SM &  "'" &_ 
"ORDER BY ProductID ASC "

I changed MM_dbtest_STRING to conn. The green line is the line im having the error with at the minute. I have tried changing this to conn too but it doesnt work. I think maybe I have to say that conn = MM_dbtest_STRING but not sure how to do this or where to say this. This may not be what I have to do but I'm trying everything!

This is the code I have now:-

%
Dim search
Dim search_numRows
Dim conn
Set conn = Server.CreateObject ("ADODB.Connection")

conn.PROVIDER = "Provider=Microsoft.Jet.OLEDB.4.0 Data Source=[dbtest.mdb.dsn] User ID=[username] Password=[password]"
Set search = Server.CreateObject("ADODB.Recordset")
search.ActiveConnection = MM_dbtest_STRING
search.Source = "SELECT * FROM product WHERE ProductID = " + Replace(search__MMColParam, "'", "''") + " ORDER BY ProductID ASC"
search.CursorType = 0
search.CursorLocation = 2
search.LockType = 1
search.Open()

search_numRows = 0
%>

Thanks for all your help!!
GLT

Let's stay at the ' and "" for a while. Putting those in wrong order or number is very common.
I don't use dreamviewer so I can't say how that works.

What I can see you are not closing the ". There is one doublequote to many at line 17,column 128.

Error message:
Microsoft VBScript compilation (0x800A0409)
Unterminated string constant
/testlogin/search.asp, line 17, column 128


What I can see you are trying to replace single quotes with double single quotes in strings that comes with the variable search__MMColParam, Correct ?

I have separated the parts of the query into lines for easier reading, AND I put the replace function into a new variable, SM. Don't forget to declare that: Dim SM

Try this:

SM = Replace(search__MMColParam, "'","''" )

search.Source = "SELECT * FROM product " &_
"WHERE ProductID = '" & SM &  "'" &_ 
"ORDER BY ProductID ASC "

Hi!

Im not trying to replace anything.. the code that I originally had was what Dreamweaver created when I created the recordset thats why I really cant understand why it wont work.

I tried what you said I put that code that you gave me in, heres what I have now:-

<%
Dim search
Dim search_numRows
Dim SM

Set search = Server.CreateObject("ADODB.Recordset")
search.ActiveConnection = MM_dbtest_STRING
SM = Replace(search_MMColParam,"'","''")
search.Source = "SELECT * FROM product WHERE ProductID "&_
"WHERE ProductID= '"&SM&"'"&_
"ORDER BY ProductID ASC"
search.CursorType = 0
search.CursorLocation = 2
search.LockType = 1
search.Open()

The line in red is the line i keep getting the error message for. I have moved this line so its probably in the wrong place at the minute but whereever it is, is the line I get an error for.

Thanks for your help!
GLT

Try this

conn.Open = "Provider=Microsoft.Jet.OLEDB.4.0 Data Source=[dbtest.mdb.dsn] User ID=[username] Password=[password]"

ok, I did what you said :-

Dim search
Dim search_numRows
Dim SM

conn.Open = "Provider=Microsoft.Jet.OLEDB.4.0 Data Source=[dbtest.mdb.dsn] User ID=[username] Password=[password]"

Set search = Server.CreateObject("ADODB.Recordset")
search.ActiveConnection = MM_dbtest_STRING
SM = Replace(search_MMColParam,"'","''")
search.Source = "SELECT * FROM product WHERE ProductID "&_
"WHERE ProductID= '"&SM&"'"&_
"ORDER BY ProductID ASC"
search.CursorType = 0
search.CursorLocation = 2
search.LockType = 1
search.Open()Dim search
Dim search_numRows
Dim SM

conn.Open = "Provider=Microsoft.Jet.OLEDB.4.0 Data Source=[dbtest.mdb.dsn] User ID=[username] Password=[password]"

Set search = Server.CreateObject("ADODB.Recordset")
search.ActiveConnection = MM_dbtest_STRING
SM = Replace(search_MMColParam,"'","''")
search.Source = "SELECT * FROM product WHERE ProductID "&_
"WHERE ProductID= '"&SM&"'"&_
"ORDER BY ProductID ASC"
search.CursorType = 0
search.CursorLocation = 2
search.LockType = 1
search.Open()

and I got this error message:-

Error Type:
Microsoft VBScript runtime (0x800A01A8)
Object required: 'conn'
/testlogin/search.asp, line 15

I declared conn:-

Dim search
Dim search_numRows
Dim SM
Dim conn
Set conn = Server.CreateObject ("ADODB.Connection")

conn.Open = "Provider=Microsoft.Jet.OLEDB.4.0 Data Source=[dbtest.mdb.dsn] User ID=[username] Password=[password]"

Set search = Server.CreateObject("ADODB.Recordset")
search.ActiveConnection = MM_dbtest_STRING
SM = Replace(search_MMColParam,"'","''")
search.Source = "SELECT * FROM product WHERE ProductID "&_
"WHERE ProductID= '"&SM&"'"&_
"ORDER BY ProductID ASC"
search.CursorType = 0
search.CursorLocation = 2
search.LockType = 1
search.Open()

and got this error message:-

Error Type:
ADODB.Connection (0x800A0E7A)
Provider cannot be found. It may not be properly installed.
/testlogin/search.asp, line 17

Okidoki

I guess you have set the DSN för your access database ?

Otherwise you can try use a DSN-less connection

Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("yourdatabasename.mdb")

Now, try to place a copy of the database in the same folder as the scriptpages to see if this works. Change the yourdatabasename.mdb to the name that you use.

yes I have set a DSN for my access database, there is no option for DSN-less connecttion just DSN and Custom Connection. The database is in a folder in the wwwroot along with the dreamweaver pages.

without changing the connection I changed just that line:-
Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("dbtest.mdb")

and got this error message:-

Error Type:
Microsoft JET Database Engine (0x80004005)
The Microsoft Jet database engine cannot open the file 'C:\Inetpub\wwwroot\testlogin\dbtest.mdb'. It is already opened exclusively by another user, or you need permission to view its data.
/testlogin/search.asp, line 17

the file is not open and of course I have permission to view it, i created it!

Thanks for all you help! the computer would have been thrown out the window a long time ago if it wasnt for the help I am getting on here! :)

GLT

When replacing a word, you have to replace all occurances:

conn.Open = "Provider=Microsoft.Jet.OLEDB.4.0 Data Source=[dbtest.mdb.dsn] User ID=[username] Password=[password]"

Set search = Server.CreateObject("ADODB.Recordset")
search.ActiveConnection = MM_dbtest_STRING

Put your username and password in. Also, "conn" is the active connection, so you need to replace MM_dbtest_STRING with conn.

Alright

It can be a permission problem.

Right click at the wwwroot and check if your account have the proper security permissions for it. If you don't have the IIS_IUSRS(yourhost\IUSRS) accont present then may have to add that one. and give it permission to read, write and so on..

Alright

It can be a permission problem.

Right click at the wwwroot and check if your account have the proper security permissions for it. If you don't have the IIS_IUSRS(yourhost\IUSRS) accont present then may have to add that one. and give it permission to read, write and so on..

I dont know! I didnt have any permissions but the IT guy changed my permissions now I can write/ read etc to wwwroot, I have put my dreamweaver and database files in here. I dont know what IIS_IUSERS(yourhost\IUSERS) is... i clicked on properties and security, I cant even see this option. If this is needed, what do I ask the IT guy for??

Sorry if these questions are a bit silly and simple!

GLT

When replacing a word, you have to replace all occurances:

conn.Open = "Provider=Microsoft.Jet.OLEDB.4.0 Data Source=[dbtest.mdb.dsn] User ID=[username] Password=[password]"

Set search = Server.CreateObject("ADODB.Recordset")
search.ActiveConnection = MM_dbtest_STRING

Put your username and password in. Also, "conn" is the active connection, so you need to replace MM_dbtest_STRING with conn.

I tried that:-

Dim search
Dim search_numRows
Dim SM
Dim conn
Set conn = Server.CreateObject ("ADODB.Connection")

conn.Open = "Provider=Microsoft.Jet.OLEDB.4.0 Data Source=[dbtest.mdb.dsn] User ID=[gthompson] Password=[Password4]"
Set search = Server.CreateObject("ADODB.Recordset")
search.ActiveConnection = conn
SM = Replace(search_MMColParam,"'","''")
search.Source = "SELECT * FROM product WHERE ProductID "&_
"WHERE ProductID= '"&SM&"'"&_
"ORDER BY ProductID ASC"
search.CursorType = 0
search.CursorLocation = 2
search.LockType = 1
search.Open()

Still wont work!
This is the error message I got:-

Error Type:
ADODB.Connection (0x800A0E7A)
Provider cannot be found. It may not be properly installed.
/testlogin/search.asp, line 17

GLT

lose the brackets, they were there to tell you that you put your password and username. Lose all [] from the string.

I tired:-
conn.Open = "Provider=Microsoft.Jet.OLEDB.4.0 Data Source=dbtest.mdb.dsn User ID=gthompson Password=Password4"

and:-

conn.Open = "Provider=Microsoft.Jet.OLEDB.4.0 Data Source=dbtest.mdb.dsn, User ID=gthompson, Password=Password4"

both came up with same error message:-

Error Type:
ADODB.Connection (0x800A0E7A)
Provider cannot be found. It may not be properly installed.
/testlogin/search.asp, line 17

"Provider=Microsoft.Jet.OLEDB.4.0; Data Source=dbtest.mdb.dsn; User ID=gthompson; Password=Password4"

must have the semi-colons.

"Provider=Microsoft.Jet.OLEDB.4.0; Data Source=dbtest.mdb.dsn; User ID=gthompson; Password=Password4"

must have the semi-colons.

this time I got this error message:-

Error Type:
Microsoft JET Database Engine (0x80040E4D)
Cannot start your application. The workgroup information file is missing or opened exclusively by another user.
/testlogin/search.asp, line 17

I dont understand the file is not missing or open.

Create a new testdb as this

Save that in a new folder named "newtestdb" (without password) under wwwroot:
1. testdb1.mdb

Create just one table and name it:
2. testtable

Create just one field and name it
3. testdata


Fill some posts in tablefield "testdata" with something like:

blla bla bla
blabla bla
bla blanaa


Open notepad and copy the code below into that and save it as "test.asp" IN THE SAME FOLDER AS the testdb1.mdb.
(I don't use dreamviewer so I don't know if it's planting any additional code by it's own)

<%
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("testdb1.mdb")

SQL = "SELECT * FROM testtable"
Set RS = Server.CreateObject("ADODB.recordset")
RS.Open SQL,Conn

Do While Not RS.EOF

Response.Write(RS("testdata") & "<br>"

RS.MoveNext
Loop
%>

You CANNOT just click on that asp file to make it run, you must do that from the webbrowser by:
http://127.0.0.1/newtestdb/test.asp
Or
http://localhost/newtestdb/test.asp

If you cannot access this database then you may have a chat with your system admin to loose up your permissions or maybe reconfigure the IIS.

yeah i think it must be my permissions! my supervisor tried something on his computer and then on my computer and it wouldnt work on mine! this is so frustrating, I have asked so many times for my permissions to be fixed!!!!

Thanks so much you guys for all your help! :)
I might be back with more questions if I still cant get it to work after my permissions are fixed.

GLT

You are welcome

I have problem in dreamweaver
when I tr or td in desing box it does not select same tag in code box I have reintalled dreamweaver & window three times now what should i do can somebody help me


deepak

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.