Re: Access Query w/VBScript
- From: "Bob Barrows [MVP]" <reb01501@xxxxxxxxxxxxxxx>
- Date: Tue, 14 Jun 2005 09:29:28 -0400
Bob wrote:
> Thank you, that did it. I added a couple of touches that make
> 'getstring' do the right (write) table stuff. Here is the final
> thing for those that may need help in the future:
>
> <%
> Option Explicit
> %>
> <HEAD>
> <TITLE>Use Access Query as Source</TITLE>
> </HEAD>
> <BODY>
> <%
> dim cn, objRS
> Set cn = createobject("adodb.connection")
> cn.open "Provider=microsoft.jet.oledb.4.0;" & _
> "Data Source=C:\Bob\Personnel.mdb"
> Set objRS = CreateObject("ADODB.Recordset")
> cn.qrySel objRS
> Response.Write "<TABLE BORDER=1><TR><TD>"
> if not objRS.EOF then Response.Write
> objrs.getstring(,,"</TD><TD>","</TD></TR><TR><TD>"," ")
> Response.Write "</TD></TR></TABLE>"
If you view the source of your page in the browser, you will notice an extra
<TR><TD>. This can make some browsers barf (IE is a little more forgiving
about bad HTML than other browsers). I usually do this (watch out for typos
<grin>):
Response.Write "<TABLE BORDER=1>"
if not objRS.EOF then sHTML=objrs.getstring(,,"</TD><TD>", _
"</TD></TR><TR><TD>"," ")
if len(sHTML) > 0 then
Response.Write "<TR><TD>"
sHTML=Left(sHTML,len(sHTML) - 8)
Response.Write sHTML
end if
Response.Write "</TABLE>"
Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
.
- Follow-Ups:
- Re: Access Query w/VBScript
- From: Bob
- Re: Access Query w/VBScript
- References:
- Re: Access Query w/VBScript
- From: Bob Barrows [MVP]
- Re: Access Query w/VBScript
- From: Bob Orta
- Re: Access Query w/VBScript
- From: Bob Barrows [MVP]
- Re: Access Query w/VBScript
- From: Bob
- Re: Access Query w/VBScript
- From: Bob Barrows [MVP]
- Re: Access Query w/VBScript
- From: Bob
- Re: Access Query w/VBScript
- Prev by Date: Re: Access Query w/VBScript
- Next by Date: Re: startup script but exclude certain machines
- Previous by thread: Re: Access Query w/VBScript
- Next by thread: Re: Access Query w/VBScript
- Index(es):
Relevant Pages
|
Loading