Re: Access Query w/VBScript



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>","&nbsp;")
> 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>","&nbsp;")
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.


.



Relevant Pages

  • Re: Access Query w/VBScript
    ... Bob wrote: ... > Microsoft VBScript runtime ... > Wrong number of arguments or invalid property assignment: 'objRS' ... Please reply to the newsgroup. ...
    (microsoft.public.scripting.vbscript)
  • Re: Thanks for all the replies folks, a few more questions...
    ... bigget issue in this newsgroup has always been about that same freedom. ... sending bogus complaints to the BBB, ... Kindly point to one posting that was anti-DIY. ... Bob on every subject for years, all because Bob refuses to attack yours ...
    (alt.security.alarms)
  • Re: Cannot access networked computers
    ... >Bob & Chuck, ... :) And Chuck, I must be ... Now look for browser problems. ... The Microsoft Browstat program will show us what browsers (I'm not talking about ...
    (microsoft.public.windowsxp.network_web)
  • Re: Error Creating ADODB.Connection Connection in IIS6
    ... I'm assuming MDAC is installed and working on the server*. ... You might try the .inetserver.iis newsgroup. ... Bob Barrows ... Brad Baker wrote: ...
    (microsoft.public.inetserver.asp.db)
  • Re: Brinks vs. Tech-man.com
    ... Don't be fooled into believing this guy by the length of his vulgar, hateful diatribes or the frequency with which he posts them. ... They've also followed me to the automation newsgroup, ... Jiminex has repeatedly threatened to destroy this newsgroup and others unless I stop posting. ... If you want to see the kind of person this guy is, check out what he's tried to do to Bob Campbell, one of the nicest people to ...
    (alt.security.alarms)

Loading