Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access_asp thread: error in code


Message #1 by "Pooja Goel" <poojagoel60@h...> on Mon, 27 Jan 2003 01:49:28
hi,

I am new to all thisa and had this error,

Microsoft VBScript compilation error '800a0409' 

Unterminated string constant 

/asp/test1.asp, line 21 

Set s1 = Conn.Execute ("SELECT basic.Author, basic.Title, 
basic.Date,basic.Publisher, basic.Location, basic.Convention, 
topics.Topics_covered

here is the code , and what i have done is, add a MS access query in this 
script. if anyone could please guide me with this, since this is my 
project in school.

<%
  dim fname
  
fname1=Request.QueryString("state")


Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open"aspe","sa",""




Set s1 = Conn.Execute ("SELECT basic.Author, basic.Title, 
basic.Date,basic.Publisher, basic.Location, basic.Convention, 
topics.Topics_covered
FROM topics INNER JOIN basic ON topics.Number = basic.Password
ORDER BY basic.Title; WHERE Author='" & fname1&"'")
  
Response.Write"<br"
While Not s1.EOF

Response.Write ""<TR><TD>"& s1.Fields.Item("Author").Value & "</TD></TR>"
Response.Write "<TR><TD>"& s1.Fields.Item("Title").Value & "</TD></TR>"
Response.Write "<TR><TD>"& s1.Fields.Item("Date").Value & "</TD></TR>"
Response.Write "<TR><TD>"& s1.Fields.Item("Publisher").Value & "</TD></TR>"
Response.Write "<TR><TD>"& s1.Fields.Item("Location").Value & "</TD></TR>"
Response.Write "<TR><TD>"& s1.Fields.Item("Convention").Value 
& "</TD></TR>"
Response.Write "<TR><TD>"& s1.Fields.Item("Topics_covered").Value 
& "</TD></TR>"


  
Response.Write"<br>"
s1.MoveNext
Wend

Response.Write(Server.HTMLEncode("submit Results"))
%>

Thank you
Message #2 by "Shabbir Moiyed" <shabbirj82@h...> on Mon, 27 Jan 2003 09:03:50
Your code is fine . But if i were you i would have used a recordset 
method .. for example

set objrs=server.createobject("adodb.recordset")
objrs.open "tablename", conn

then i would set a sql statement in a string 

sqlstr="SELECT basic.Author, basic.Title, 
basic.Date,basic.Publisher, basic.Location, basic.Convention, 
topics.Topics_covered FROM topics INNER JOIN basic ON topics.Number = 
basic.Password ORDER BY basic.Title;" 

sqlstr =sqlstr &"WHERE Author='" &fname1 &"'"

after this you just do 

response.write sqlstr

which will show you up the values that are being passed and then you can 
hard code further. 

in order to run this query you can do the following 

objrs.execute(sqlstr)

and this will be executed

take it easy and all the best

Shabbir Jamali 


> hi,

> I am new to all thisa and had this error,

> Microsoft VBScript compilation error '800a0409' 

> Unterminated string constant 

> /asp/test1.asp, line 21 

> Set s1 = Conn.Execute ("SELECT basic.Author, basic.Title, 
b> asic.Date,basic.Publisher, basic.Location, basic.Convention, 
t> opics.Topics_covered

> here is the code , and what i have done is, add a MS access query in 
this 
s> cript. if anyone could please guide me with this, since this is my 
p> roject in school.

> <%
 >  dim fname
 >  
f> name1=Request.QueryString("state")

> 
S> et Conn = Server.CreateObject("ADODB.Connection")
C> onn.Open"aspe","sa",""

> 

> 
S> et s1 = Conn.Execute ("SELECT basic.Author, basic.Title, 
b> asic.Date,basic.Publisher, basic.Location, basic.Convention, 
t> opics.Topics_covered
F> ROM topics INNER JOIN basic ON topics.Number = basic.Password
O> RDER BY basic.Title; WHERE Author='" & fname1&"'")
 >  
R> esponse.Write"<br"
W> hile Not s1.EOF

> Response.Write ""<TR><TD>"& s1.Fields.Item("Author").Value & "</TD></TR>"
R> esponse.Write "<TR><TD>"& s1.Fields.Item("Title").Value & "</TD></TR>"
R> esponse.Write "<TR><TD>"& s1.Fields.Item("Date").Value & "</TD></TR>"
R> esponse.Write "<TR><TD>"& s1.Fields.Item("Publisher").Value 
& "</TD></TR>"
R> esponse.Write "<TR><TD>"& s1.Fields.Item("Location").Value 
& "</TD></TR>"
R> esponse.Write "<TR><TD>"& s1.Fields.Item("Convention").Value 
&>  "</TD></TR>"
R> esponse.Write "<TR><TD>"& s1.Fields.Item("Topics_covered").Value 
&>  "</TD></TR>"

> 
 >  
R> esponse.Write"<br>"
s> 1.MoveNext
W> end

> Response.Write(Server.HTMLEncode("submit Results"))
%> >

> Thank you

  Return to Index