Thread View: comp.lang.basic.visual.misc
8 messages
8 total messages
Started by Chad Gough
Mon, 05 Apr 1999 00:00
Syntax Question?
Author: Chad Gough
Date: Mon, 05 Apr 1999 00:00
Date: Mon, 05 Apr 1999 00:00
11 lines
1459 bytes
1459 bytes
I have a VB script in an ASP page running a query. The SQL code looks like: sql = "SELECT DISTINCT songs.Song FROM songs WHERE songs.artist = '????' " What is the syntax to put a variable where ???? is? The query works fine if I replace ???? with a value from the database!?!? Any help would be appreciated. Thanks
Re: Syntax Question?
Author: Stig Joar Sanden
Date: Tue, 06 Apr 1999 00:00
Date: Tue, 06 Apr 1999 00:00
31 lines
1852 bytes
1852 bytes
This is written with the eyes almost closed, but i think it will work :) sql = "SELECT DISTINCT songs.Song FROM songs WHERE songs.artist LIKE '" & Variable & "'" Remark that after songs.artist LIKE there is ' " after Variable & there is " ' " HTH :) Stig Joar Sanden sandman@online.no ICQ: 13557997 Chad Gough skrev i meldingen ... >I have a VB script in an ASP page running a query. > >The SQL code looks like: >sql = "SELECT DISTINCT songs.Song FROM songs WHERE songs.artist = '????' " > >What is the syntax to put a variable where ???? is? >The query works fine if I replace ???? with a value from the database!?!? > >Any help would be appreciated. > >Thanks > >
Re: Syntax Question?
Author: David Wier
Date: Tue, 06 Apr 1999 00:00
Date: Tue, 06 Apr 1999 00:00
22 lines
1682 bytes
1682 bytes
I have a tutorial on using Quotes in ASP at my site...check it out. -- David Wier http://www.aspexpress.com http://www.augustwind.com Designer of the Best ASP Editor in the Galaxy Chad Gough wrote in message ... >I have a VB script in an ASP page running a query. > >The SQL code looks like: >sql = "SELECT DISTINCT songs.Song FROM songs WHERE songs.artist = '????' " > >What is the syntax to put a variable where ???? is? >The query works fine if I replace ???? with a value from the database!?!? > >Any help would be appreciated. > >Thanks > >
Re: Syntax Question?
Author: Chad Gough
Date: Tue, 06 Apr 1999 00:00
Date: Tue, 06 Apr 1999 00:00
33 lines
1953 bytes
1953 bytes
I tried sql = "SELECT DISTINCT songs.Song FROM songs WHERE songs.artist LIKE ' "&art&" ' " but got: ADODB.Field error '800a0bcd' Either BOF or EOF is True, or the current record has been deleted; the operation requested by the application requires a current record. /file.asp, line 55 Stig Joar Sanden <sandman@online.no> wrote in message news:xtcO2.572$l5.2625@news1.online.no... > This is written with the eyes almost closed, but i think it will work :) > > sql = "SELECT DISTINCT songs.Song FROM songs WHERE songs.artist LIKE '" & > Variable & "'" > > Remark that after songs.artist LIKE there is ' " > after Variable & there is " ' " > > HTH :) > Stig Joar Sanden > sandman@online.no > ICQ: 13557997 >
Re: Syntax Question?
Author: Stig Joar Sanden
Date: Tue, 06 Apr 1999 00:00
Date: Tue, 06 Apr 1999 00:00
51 lines
2392 bytes
2392 bytes
Try this (I didn't mean it should be spaces between quotes, just to illustrate for you :) But there is to be spaces after/before quotes and & sql = "SELECT DISTINCT songs.Song FROM songs WHERE songs.artist LIKE '" & art & "'" Stig Joar Sanden sandman@online.no ICQ: 13557997 Chad Gough skrev i meldingen <9bdO2.5837$033.1800@news.rdc1.il.home.com>... >I tried > >sql = "SELECT DISTINCT songs.Song FROM songs WHERE songs.artist LIKE ' >"&art&" ' " > > >but got: > >ADODB.Field error '800a0bcd' > >Either BOF or EOF is True, or the current record has been deleted; the >operation requested by the application requires a current record. > >/file.asp, line 55 > > > >Stig Joar Sanden <sandman@online.no> wrote in message >news:xtcO2.572$l5.2625@news1.online.no... >> This is written with the eyes almost closed, but i think it will work :) >> >> sql = "SELECT DISTINCT songs.Song FROM songs WHERE songs.artist LIKE '" >& >> Variable & "'" >> >> Remark that after songs.artist LIKE there is ' " >> after Variable & there is " ' " >> >> HTH :) >> Stig Joar Sanden >> sandman@online.no >> ICQ: 13557997 >> > > >
Re: Syntax Question?
Author: Chad Gough
Date: Tue, 06 Apr 1999 00:00
Date: Tue, 06 Apr 1999 00:00
50 lines
2429 bytes
2429 bytes
Still having problems!
sql = "SELECT DISTINCT songs.Song FROM songs WHERE songs.artist
='"&art&"'"
(quotes after songs.artist = are single, double, variable, double, single,
double)
and i still get:
ADODB.Field error '800a0bcd'
Either BOF or EOF is True, or the current record has been deleted; the
operation requested by the application requires a current record.
/file.asp, line 52
If i use:
<%=art%>
anywhere else on the page, it displays the right info !?!?
Ideas?
David Wier <dwier@home.com> wrote in message
news:H7dO2.29152$SZ5.9745@news.rdc1.tx.home.com...
> I have a tutorial on using Quotes in ASP at my site...check it out.
> --
> David Wier
> http://www.aspexpress.com
> http://www.augustwind.com
> Designer of the Best ASP Editor in the Galaxy
>
> Chad Gough wrote in message ...
> >I have a VB script in an ASP page running a query.
> >
> >The SQL code looks like:
> >sql = "SELECT DISTINCT songs.Song FROM songs WHERE songs.artist =
'????'
> "
> >
> >What is the syntax to put a variable where ???? is?
> >The query works fine if I replace ???? with a value from the database!?!?
> >
> >Any help would be appreciated.
> >
> >Thanks
> >
> >
>
>
Re: Syntax Question?
Author: David Wier
Date: Tue, 06 Apr 1999 00:00
Date: Tue, 06 Apr 1999 00:00
76 lines
3343 bytes
3343 bytes
What are you looking to find - an exact match or an approximate match on: 1. is art a variable or 2. is art three exact letters Basically, what is art? If it's a field name, that's even different than the two above and you are going in the wrong direction - in your select statement, where compares a fieldname (songs.artist) to whatever art is. So in that context, art should be exact text or a variable. sql="Select DISTINCT Songs.song from songs Where songs.artist Like '%art%'" The above statement will give you any artist with the letters 'art' somewhere it it - Like Bart, Art, Martin, etc. Notice the Percent signs instead of ampersands... If art is a variable, that's different. -- David Wier http://www.aspexpress.com http://www.augustwind.com Designer of the Best ASP Editor in the Galaxy Chad Gough wrote in message ... >Still having problems! > > sql = "SELECT DISTINCT songs.Song FROM songs WHERE songs.artist >='"&art&"'" >(quotes after songs.artist = are single, double, variable, double, single, >double) > >and i still get: >ADODB.Field error '800a0bcd' > >Either BOF or EOF is True, or the current record has been deleted; the >operation requested by the application requires a current record. > >/file.asp, line 52 > >If i use: ><%=art%> >anywhere else on the page, it displays the right info !?!? > >Ideas? > > > >David Wier <dwier@home.com> wrote in message >news:H7dO2.29152$SZ5.9745@news.rdc1.tx.home.com... >> I have a tutorial on using Quotes in ASP at my site...check it out. >> -- >> David Wier >> http://www.aspexpress.com >> http://www.augustwind.com >> Designer of the Best ASP Editor in the Galaxy >> >> Chad Gough wrote in message ... >> >I have a VB script in an ASP page running a query. >> > >> >The SQL code looks like: >> >sql = "SELECT DISTINCT songs.Song FROM songs WHERE songs.artist = >'????' >> " >> > >> >What is the syntax to put a variable where ???? is? >> >The query works fine if I replace ???? with a value from the database!?!? >> > >> >Any help would be appreciated. >> > >> >Thanks >> > >> > >> >> > >
Re: Syntax Question?
Author: Gavin Walker
Date: Wed, 07 Apr 1999 00:00
Date: Wed, 07 Apr 1999 00:00
34 lines
1768 bytes
1768 bytes
Chad, Maybe I'm being dim here. Try: sql = "SELECT DISTINCT songs.Song FROM songs WHERE songs.artist = '" & Trim(strMyVariable) & "' " Where strMyVariable is a variable holding your artist name. Is this what you mean? Writing a music site are you? Should I be helping you ;o)? Regards, Gavin Walker Chad Gough wrote in message ... >I have a VB script in an ASP page running a query. > >The SQL code looks like: >sql = "SELECT DISTINCT songs.Song FROM songs WHERE songs.artist = '????' " > >What is the syntax to put a variable where ???? is? >The query works fine if I replace ???? with a value from the database!?!? > >Any help would be appreciated. > >Thanks > >
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads