Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: running Access query with spaces in name


Message #1 by "Ken Mosher" <vorlon_ken@h...> on Fri, 29 Sep 2000 20:54:38 +0100
I'm wondering if ASP can run an Access query if there are spaces in the

name of the query. It seems, with my limited testing, that it can't.  (I

got the method from Beginning ASP 2.0.  If there's a better way I'm glad

to learn it.)



If I'm wrong will someone please let me know how?  For me example 1 works,

example 2 doesn't.  The only thing I changed was the name of the query...

While I'm on the subject of spaces, ultimately I need to pass a town code

as a parameter - can the parameter name have spaces in it (no biggie if it

can't).  Having to name my queries with no spaces would make me sad but

would not ruin my life.



Ex 1

- - - - - - - - - - - - - - -

'there are no parameters

connectstring = "Driver={Microsoft Access Driver (*.mdb)}; DBQ=webdb.mdb"

set LHCommand = Server.CreateObject("ADODB.Command")

LHCommand.ActiveConnection = connectstring

LHCommand.CommandText = "qrytest"

LHCommand.CommandType = adcmdstoredproc



set LHQryRes = Server.CreateObject("ADODB.Recordset")

response.write "about to run query<br>"

response.flush

set LHQryRes = LHCommand.execute 

'Recordset is returned correctly

- - - - - - - - - - - - - - -



Ex 2

- - - - - - - - - - - - - - -

connectstring = "Driver={Microsoft Access Driver (*.mdb)}; DBQ=webdb.mdb"

set LHCommand = Server.CreateObject("ADODB.Command")

LHCommand.ActiveConnection = connectstring

LHCommand.CommandText = "qry test"

LHCommand.CommandType = adcmdstoredproc



set LHQryRes = Server.CreateObject("ADODB.Recordset")

response.write "about to run query<br>"

response.flush

set LHQryRes = LHCommand.execute 

'request never returns from web server, "about to run query" is 

'all that appears

- - - - - - - - - - - - - - -



Thanks in advance,

Ken


  Return to Index