Ask a Question related to ASP Database, Design and Development.
- Micromanaged #1
ASP & Access2k question
Running asp pages against an Access 2k database.
2 questions for those vastly more knowledgeable than myself.
- Are wildcards allowed in Access 2k SQL statements? If so, what are
they, and what, if anything, do I need to be aware of programmatically
in ASP?
- Can I use the 'LIKE' keyword in Access 2k SQL statements? If so, what
is the correct syntax both within the database directly and is ASP?
Thanks.
*** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
Don't just participate in USENET...get rewarded for it!
Micromanaged Guest
-
Good morning or good evening depending upon your location. I want to ask you the most important question of your life. Your joy or sorrow for all eternity depends upon your answer. The question is: Are you saved? It is not a question of how good you
<[email protected]> wrote in message news:[email protected].. This is the most important question of... -
newB question: related tables question
hello i have a data base with 10 tables, i want to automaticaly creat a row in all of the tables wehen i create in the first one. normal table... - Ken Schaefer #2
Re: ASP & Access2k question a) Yes you can use wildcards. For OLEDB Provider, you use standard ANSI SQL
wildcards.
b) Yes, you can use LIKE
[url]www.adopenstatic.com/faq/likequeries.asp[/url]
Cheers
Ken
"Micromanaged" <[email protected]> wrote in message
news:ucb4$[email protected]..>
>
> Running asp pages against an Access 2k database.
>
> 2 questions for those vastly more knowledgeable than myself.
>
> - Are wildcards allowed in Access 2k SQL statements? If so, what are
> they, and what, if anything, do I need to be aware of programmatically
> in ASP?
>
> - Can I use the 'LIKE' keyword in Access 2k SQL statements? If so, what
> is the correct syntax both within the database directly and is ASP?
>
> Thanks.
Ken Schaefer Guest
- PW #3
Re: ASP & Access2k question
"Micromanaged" <[email protected]> wrote in message
news:ucb4$[email protected]..> - Are wildcards allowed in Access 2k SQL statements? If so, what are
> they, and what, if anything, do I need to be aware of programmatically
> in ASP?
>
> - Can I use the 'LIKE' keyword in Access 2k SQL statements? If so, what
> is the correct syntax both within the database directly and is ASP?
>
Select * from myTable where FIELD like "%text%"
HTH,
PW
PW Guest
- Bullschmidt #4
Re: ASP & Access2k question <<
- Are wildcards allowed in Access 2k SQL statements? If so, what are
they, and what, if anything, do I need to be aware of programmatically
in ASP?
- Can I use the 'LIKE' keyword in Access 2k SQL statements? If so, what
is the correct syntax both within the database directly and is ASP?Like Options:>>
All except blanks:
Like '%'
Starting with A:
Like 'A%'
Or could do this: Like 'a%'
A somewhere in the field:
Like '%A%'
Or could do this: Like '%a%'
One character an A or B or D:
Like '[A,B,D]'
Or could do this: Like '[a,b,d]'
One character A through C as the first character:
Like '[A-C]%'
Or could do this: Like '[a-c]%'
A through C as the 1st character and A through H as the 2nd character:
Like '[A-C][A-H]%'
Or could do this: Like '[a-c][a-h]%'
Starting with Sm, ending with th, and anything for the 3rd character:
Like 'SM?TH'
Or could do this: Like 'sm?th'
Digit for the 1st character:
Like '#%'
Or could do this: Like '[0-9]%'
Not in a range of letters:
Like '[!a-c]'
Not start with a range of letters:
Like '[!a-c]%'
Not start with a number:
Or could do this: Like '[!0-9]%'
Best regards,
J. Paul Schmidt, Freelance ASP Web Developer
[url]http://www.Bullschmidt.com[/url]
Classic ASP Design Tips, ASP Web Database Sample (Freely Downloadable)
*** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
Don't just participate in USENET...get rewarded for it!
Bullschmidt Guest
- Harag #5
Re: ASP & Access2k question On Wed, 28 Jul 2004 09:31:33 +0800, "PW" <[email protected]>
wrote:
I wouldn't recommend using the "Select * from " - Name the columns>
>"Micromanaged" <[email protected]> wrote in message
>news:ucb4$[email protected]..>>> - Are wildcards allowed in Access 2k SQL statements? If so, what are
>> they, and what, if anything, do I need to be aware of programmatically
>> in ASP?
>>
>> - Can I use the 'LIKE' keyword in Access 2k SQL statements? If so, what
>> is the correct syntax both within the database directly and is ASP?
>>
>
>
>Select * from myTable where FIELD like "%text%"
>
you want including in the result. By putting a * your making the DB
engine work harder, (just to save you some typing) First the engine
has to find out what columns are in a table then get the info. If you
tell it what columns you want this has 2 advantages.
1) The engine knows the columns so can just return the info
2) it will help you later on (or other coders) when you relook at your
code.
HTH
Al.
Harag Guest
- Aaron [SQL Server MVP] #6
Re: ASP & Access2k question > Select * from myTable where FIELD like "%text%"
Use ' not " for delimiting the string inside the SQL statement.
And don't use SELECT *
--
[url]http://www.aspfaq.com/[/url]
(Reverse address to reply.)
Aaron [SQL Server MVP] Guest
- Micromanaged #7
Re: ASP & Access2k question
This is the error I get when I enter a% on the asp page:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing
operator) in query expression '(CompanyName LIKE 'a%' ORDER BY
CompanyName'.
/lioa/srchrslts.asp, line 127
This is the code involved:
Dim objConn
Set objConn=Server.CreateObject("ADODB.Connection")
objConn.ConnectionString="DRIVER={Microsoft Access Driver (*.mdb)};" & _
"DBQ=" & DBPath
objConn.Open
Dim strSQL
If rsrch="CompanyName" Then
strSQL="SELECT Distinct CompanyName, AddressLine1, AddressLine2,
AddressLine3, " & _
"City, State, Zip, Country FROM Customers " & _
"WHERE (CompanyName LIKE '" & rcrtra & "' " & _
"ORDER BY CompanyName"
End If
Response.Write("<tr><td>" & objRS.Fields.Item(0).Value & "</td><td>" &
objRS.Fields.Item(1) & "</td><td>" & objRS.Fields.Item(2) & "</td><td>"
& objRS.Fields.Item(3) & "</td><td>" & objRS.Fields.Item(4) &
"</td></tr>")
objRS.MoveNext
Set objRS=Nothing
objConn.Close
Set objConn=Nothing
*** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
Don't just participate in USENET...get rewarded for it!
Micromanaged Guest
- Aaron [SQL Server MVP] #8
Re: ASP & Access2k question Well, you have an opening ( but not a closing ) ...
You probably could have caught this yourself, using:
Response.Write StrSQL
--
[url]http://www.aspfaq.com/[/url]
(Reverse address to reply.)
"Micromanaged" <[email protected]> wrote in message
news:ey$[email protected]..>
>
> This is the error I get when I enter a% on the asp page:
>
> Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
> [Microsoft][ODBC Microsoft Access Driver] Syntax error (missing
> operator) in query expression '(CompanyName LIKE 'a%' ORDER BY
> CompanyName'.
> /lioa/srchrslts.asp, line 127
>
> This is the code involved:
>
> Dim objConn
> Set objConn=Server.CreateObject("ADODB.Connection")
> objConn.ConnectionString="DRIVER={Microsoft Access Driver (*.mdb)};" & _
> "DBQ=" & DBPath
>
> objConn.Open
> Dim strSQL
>
> If rsrch="CompanyName" Then
> strSQL="SELECT Distinct CompanyName, AddressLine1, AddressLine2,
> AddressLine3, " & _
> "City, State, Zip, Country FROM Customers " & _
> "WHERE (CompanyName LIKE '" & rcrtra & "' " & _
> "ORDER BY CompanyName"
> End If
>
> Response.Write("<tr><td>" & objRS.Fields.Item(0).Value & "</td><td>" &
> objRS.Fields.Item(1) & "</td><td>" & objRS.Fields.Item(2) & "</td><td>"
> & objRS.Fields.Item(3) & "</td><td>" & objRS.Fields.Item(4) &
> "</td></tr>")
> objRS.MoveNext
>
> Set objRS=Nothing
> objConn.Close
> Set objConn=Nothing
>
> *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
> Don't just participate in USENET...get rewarded for it!
Aaron [SQL Server MVP] Guest
- Micromanaged #9
Re: ASP & Access2k question
That did the trick. I ran a response.write and noticed that I neglected
to put a closing ) on my SQL statement. Corrected that, and life works
now.
Thanks for the assistance.
*** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
Don't just participate in USENET...get rewarded for it!
Micromanaged Guest




