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

Tech-Archive recommends: Fix windows errors by optimizing your registry

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: Retriving data from DB
    ... rsRecordset("Name"), which name would I get from the recordset, the first ... > the fields in your table and generate this sql statement for you (and even ... > post to an Access newsgroup for help. ... >> tblSchedule and tlbScheduleAdd ...
    (microsoft.public.inetserver.asp.db)
  • 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)
  • Re: insert into error
    ... > Microsoft JET Database Engine ... > I've done a response.write with the SQL statement and I get this ... it's silly to be forced to worry about delimiters (let alone ... Please reply to the newsgroup. ...
    (microsoft.public.inetserver.asp.db)