View Full Version : Another Newb Pleading for help

04-06-2009, 02:45 AM
I have started working through Mastering Dreamweaver MX Databases and when I test the database connection all seems ok.

I have created the 2 files below from the tutorial (cut and paste )but keep getting errors and not the results that are expected. If someone has a moment to have a look I would very much apreciate it. I am not sure if I just have not set up the connection correctly or if there is an error in the script. Its a bit frustrating when the first basic tutorial fails

(This uses the MS Access Northwind.mdb database)

Listing 4.2: CH4LIST2.ASP
<title>Chapter 4, Listing 2 Example</title>



<form name="frmChapter4Listing2" method="post" action="ch4list3.asp" >

<p> Enter the customer's name and then click the Submit button to see a list of orders. <p>

<tr>...<td width="45%">Customer </td>...<input type="text" name="txtcompanyname"> </tr>

...<input type="submit" name="Submit" value="Submit"> </form>...

Listing 4.3: CH4LIST3.ASP

Dim companyname
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "nwindDSN"
companyname = Request.Form("txtcompanyname")
SQL = "SELECT Customers.CompanyName, Orders.OrderID
FROM Customers INNER JOIN Orders ON
Customers.CustomerID = Orders.CustomerID
WHERE CompanyName = '" & companyname
& "'" Set rst = Conn.Execute(SQL)
<%Do While Not rst.EOF%>
...<%Response.Write rst("CompanyName")%>&nbsp
...<%Response.Write rst("OrderID")%>

The error :

Error Type:
Microsoft VBScript compilation (0x800A0409)
Unterminated string constant
/ch4list3.asp, line 6, column 51
SQL = "SELECT Customers.CompanyName, Orders.OrderID


04-06-2009, 02:49 PM
Check here for the reason of your error:

scroll down the page and look for your error number