David
|
| Posted: 03/16/2002, 4:21 PM |
|
I am using this statement in the before show event of a form :
fldnwheelchairsjnr=dlookup("Patients","count(*)","borrowed=2")
What Im trying to do is display the number of records in the
table:"Patients" for which the borrowed field = 2
Can neone tell me what im doing wrong? cheers
|
|
|
 |
Glenn Holden
|
| Posted: 03/16/2002, 5:22 PM |
|
The SQL is probably ok. You could try and test it in a SQL editor for your
platform.
it would be :
select count(*) from patients where borrowed=2;
The only thing I see that may be wrong depending on your server/SQL. For
PHP/MySQL you need it to be (added a $ at the beginning of any variable, and
; to end any statement):
$fldnwheelchairsjnr=dlookup("Patients","count(*)","borrowed=2");
Let us know when you find it.
Glenn
"David" <dava133@ntlworld.com> wrote in message
news:a70nj1$m64$1@news.codecharge.com...
> I am using this statement in the before show event of a form :
>
> fldnwheelchairsjnr=dlookup("Patients","count(*)","borrowed=2")
>
> What Im trying to do is display the number of records in the
> table:"Patients" for which the borrowed field = 2
>
> Can neone tell me what im doing wrong? cheers
>
>
>
>
|
|
|
 |
David
|
| Posted: 03/17/2002, 8:23 AM |
|
Its ASP w/templates, do i need the ;?? what do u mean by SQL editor for my
platform? also if it helps Im getting an IE error 500 internal server error,
Cheers
David
"Glenn Holden" <glenn@nilenet.com> wrote in message
news:a70r52$sck$1@news.codecharge.com...
> The SQL is probably ok. You could try and test it in a SQL editor for
your
> platform.
> it would be :
> select count(*) from patients where borrowed=2;
>
> The only thing I see that may be wrong depending on your server/SQL. For
> PHP/MySQL you need it to be (added a $ at the beginning of any variable,
and
> ; to end any statement):
>
> $fldnwheelchairsjnr=dlookup("Patients","count(*)","borrowed=2");
>
> Let us know when you find it.
> Glenn
>
>
> "David" <dava133@ntlworld.com> wrote in message
>news:a70nj1$m64$1@news.codecharge.com...
> > I am using this statement in the before show event of a form :
> >
> > fldnwheelchairsjnr=dlookup("Patients","count(*)","borrowed=2")
> >
> > What Im trying to do is display the number of records in the
> > table:"Patients" for which the borrowed field = 2
> >
> > Can neone tell me what im doing wrong? cheers
> >
> >
> >
> >
>
>
|
|
|
 |
Glenn Holden
|
| Posted: 03/17/2002, 9:22 AM |
|
I believe your syntax is fine for ASP. (but you can't really trust me on
that)
What I meant by a SQL editor was to connect to your specific database with
an admin tool that lets you perform querys to the database. If you use
MSSQL, you could use the management console provided from Microsoft; for
MySQL there are command line and GUI utilities for this; etc...
Connecting directly to the database lets you build and hone your SQL without
the ASP and CodeCharge or anything else "in the way." Once the SQL is
returning a result you can work with take it to CodeCharge. There you may
have to change the literal values you test with to variables. In your case
it looks so simple I don't know what you'd change! I guess when I'm having
trouble, I like to test it in different ways to localize and rule out
different parts of the puzzle.
Since you are getting an error (and I don't know what it means, sorry), you
may want to take a look at the dlookup function and see that it is
generating the SQL you think it is. (or post it here) I think you'll find
the code if you go to the modules section and obtain generated code for the
Common 'event'.
Scratching here... have you tried replacing the 'count(*)' for a
'count(some_key_column)' MySQL should be fine with count(*) but I don't
remember if MS SQL prefers a specific field.
Glenn
"David" <dava133@ntlworld.com> wrote in message
news:a72ftl$rke$1@news.codecharge.com...
> Its ASP w/templates, do i need the ;?? what do u mean by SQL editor for my
> platform? also if it helps Im getting an IE error 500 internal server
error,
> Cheers
>
> David
>
> "Glenn Holden" <glenn@nilenet.com> wrote in message
>news:a70r52$sck$1@news.codecharge.com...
> > The SQL is probably ok. You could try and test it in a SQL editor for
> your
> > platform.
> > it would be :
> > select count(*) from patients where borrowed=2;
> >
> > The only thing I see that may be wrong depending on your server/SQL. For
> > PHP/MySQL you need it to be (added a $ at the beginning of any variable,
> and
> > ; to end any statement):
> >
> > $fldnwheelchairsjnr=dlookup("Patients","count(*)","borrowed=2");
> >
> > Let us know when you find it.
> > Glenn
> >
> >
> > "David" <dava133@ntlworld.com> wrote in message
> >news:a70nj1$m64$1@news.codecharge.com...
> > > I am using this statement in the before show event of a form :
> > >
> > > fldnwheelchairsjnr=dlookup("Patients","count(*)","borrowed=2")
> > >
> > > What Im trying to do is display the number of records in the
> > > table:"Patients" for which the borrowed field = 2
> > >
> > > Can neone tell me what im doing wrong? cheers
> > >
> > >
> > >
> > >
> >
> >
>
>
|
|
|
 |
David
|
| Posted: 03/17/2002, 3:02 PM |
|
cheers ill try the last suggestion and let u know how i get on
"Glenn Holden" <glenn@nilenet.com> wrote in message
news:a72jch$1so$1@news.codecharge.com...
> I believe your syntax is fine for ASP. (but you can't really trust me on
> that)
>
> What I meant by a SQL editor was to connect to your specific database with
> an admin tool that lets you perform querys to the database. If you use
> MSSQL, you could use the management console provided from Microsoft; for
> MySQL there are command line and GUI utilities for this; etc...
>
> Connecting directly to the database lets you build and hone your SQL
without
> the ASP and CodeCharge or anything else "in the way." Once the SQL is
> returning a result you can work with take it to CodeCharge. There you may
> have to change the literal values you test with to variables. In your
case
> it looks so simple I don't know what you'd change! I guess when I'm
having
> trouble, I like to test it in different ways to localize and rule out
> different parts of the puzzle.
>
> Since you are getting an error (and I don't know what it means, sorry),
you
> may want to take a look at the dlookup function and see that it is
> generating the SQL you think it is. (or post it here) I think you'll
find
> the code if you go to the modules section and obtain generated code for
the
> Common 'event'.
>
> Scratching here... have you tried replacing the 'count(*)' for a
> 'count(some_key_column)' MySQL should be fine with count(*) but I don't
> remember if MS SQL prefers a specific field.
>
> Glenn
>
>
> "David" <dava133@ntlworld.com> wrote in message
>news:a72ftl$rke$1@news.codecharge.com...
> > Its ASP w/templates, do i need the ;?? what do u mean by SQL editor for
my
> > platform? also if it helps Im getting an IE error 500 internal server
> error,
> > Cheers
> >
> > David
> >
> > "Glenn Holden" <glenn@nilenet.com> wrote in message
> >news:a70r52$sck$1@news.codecharge.com...
> > > The SQL is probably ok. You could try and test it in a SQL editor for
> > your
> > > platform.
> > > it would be :
> > > select count(*) from patients where borrowed=2;
> > >
> > > The only thing I see that may be wrong depending on your server/SQL.
For
> > > PHP/MySQL you need it to be (added a $ at the beginning of any
variable,
> > and
> > > ; to end any statement):
> > >
> > > $fldnwheelchairsjnr=dlookup("Patients","count(*)","borrowed=2");
> > >
> > > Let us know when you find it.
> > > Glenn
> > >
> > >
> > > "David" <dava133@ntlworld.com> wrote in message
> > >news:a70nj1$m64$1@news.codecharge.com...
> > > > I am using this statement in the before show event of a form :
> > > >
> > > > fldnwheelchairsjnr=dlookup("Patients","count(*)","borrowed=2")
> > > >
> > > > What Im trying to do is display the number of records in the
> > > > table:"Patients" for which the borrowed field = 2
> > > >
> > > > Can neone tell me what im doing wrong? cheers
> > > >
> > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>
|
|
|
 |
|