Re: name of field is in variable: how to use in SQL?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Burt (burtspam_at_me.us)
Date: 08/04/04


Date: Wed, 4 Aug 2004 15:25:00 +0200

I appreciate your work, really, but you are not my teacher and i'm not your
student. Sometimes one needs a urgent answer and sometimes, there is no time
for experimentation.
Thanks anyway
B

"Bob Barrows [MVP]" <reb01501@NOyahoo.SPAMcom> wrote in message
news:%23jR02DieEHA.3916@TK2MSFTNGP11.phx.gbl...
> Burt wrote:
> > Sorry, in fact this works, but i can't recover the field values:
> >
> > a="maandag"
> > set objdc = Server.CreateObject("ADODB.Connection")
> > objdc.Open("provider=Microsoft.Jet.OLEDB.4.0; Data Source
> > =d:\access\newres.mdb")
> > sql="select '" & a & "' from daguur;"
>
> You're not getting my point. Show us the result from "response.write sql"
>
> > set rs=Server.CreateObject("ADODB.recordset")
> > rs.open sql, objdc, 3, 3
> > response.write(rs.RecordCount) ' this works
>
> Of course this works. You are getting records back. You're just not
getting
> records containing a field named maandag. Do this to see what you are
> getting:
>
> for each fld in rs.Fields
> response.write fld.OrdinalPosition & ". " & fld.name & ": " & _
> fld.value & "<BR>"
> next
>
>
> Did you try my suggestion of response.writing the sql variable and copying
> te result into the Access Query Builder to see what the sql statement you
> built returned? Obviously not. I dislike hand-holding, but just to bring
> this thread to an end, change your statement to:
>
> sql="select [" & a & "] from daguur;"
>
> I'm out of here.
>
> 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

  • "..because one did not pay attention to what came out of the other persons mouth."
    ... I hendry leon, do not know who you are or what are the motives behind ... out of the other person's mouth (instead, ... Newsgroup (which i have tried many times to erase but have not been ... Sept '97- April '98 a part-time student under a program for adult ...
    (soc.religion.quaker)
  • Re: Cant Add Fields to Form
    ... Look at the Record Source property of the form. ... the SQL statement or the saved query before they will be visible to the ... "Jeff Miller" wrote in message ... Hoping I'm posting to the right newsgroup. ...
    (microsoft.public.access.forms)
  • RE: Mad monitoring error 9099
    ... If the issue is urgent to your business, ... It is recommended that you contact Microsoft Product ... Support Services via telephone so that a dedicated Support Professional can ... Microsoft CSS Online Newsgroup Support ...
    (microsoft.public.windows.server.sbs)
  • Big Bertha Thing gyro
    ... Big Bertha Thing gyro ... This film portrays a dominant spouse and a long-suffering student, ... Microsoft has already pushed the button to close this newsgroup. ... Microsoft wants your postings on its proprietary newsgroup. ...
    (microsoft.public.win32.programmer.tapi)
  • Big Bertha Thing gyro
    ... Big Bertha Thing gyro ... This film portrays a dominant spouse and a long-suffering student, ... Microsoft has already pushed the button to close this newsgroup. ... Microsoft wants your postings on its proprietary newsgroup. ...
    (microsoft.public.windowsce.embedded.vc)