p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   Dreamweaver (all versions) (http://p2p.wrox.com/forumdisplay.php?f=58)
-   -   SQL HELP (http://p2p.wrox.com/showthread.php?t=35952)

malhyp December 9th, 2005 03:50 AM

SQL HELP
 
Hey to Imar & all.

I have played around with SQL and so far have not been successfull.
Can anyone suggest or post what my SQL statment should read.
I have included the following information.

Database Name: datab.mdb
Table Name: tblQuery1
Column Names: name
            location
            description
Recordset Name: redord1

Results Page Name: result.asp

Search Page Name: search.asp
Search Page Filed Names:
Textfield: keywordSearch
List/Menu: category
List/Menu: location

If I have left anything out please ask me.

Thanks for all your help.

Mally.

Imar December 9th, 2005 06:06 AM

Hi Mally,

I am not sure what you're asking here. What are you trying to accomplish?

What kind of answer are you looking for?

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.

malhyp December 9th, 2005 06:09 AM

Trying to created an advanced recordset so that when you search it searches using the three fields that are in the search page.

Im not sure how to create the SQL manualy.

Imar December 9th, 2005 06:28 AM

Are you aware of the keyword LIKE in T-SQL? With LIKE you can search a column for part of a string:

SELECT Name FROM tblQuery1 WHERE Name LIKE '%mal%'

will find all records with mal in it, including mally etc.

The % works as a wildcard, so when you leave out one of the two, the column should either start or end with the text you're searching for.

Does this help?

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.

malhyp December 9th, 2005 07:55 AM

I get the general meaning of that. Trying to delete an existing recordset, but every time I click on the minus symbol at the top it dose not delete the recordset. Any ideas why?

malhyp December 9th, 2005 08:51 AM

Its ok, the recordset has been deleted. I think my problem may be the database.

When in Dreamweaver, testing a recordset. In the filter section there are several fields. A few of them work when you test them. Most of them come up with an error message.

[Microsoft][ODBC Microsoft Access Driver]Syntax error(missing operator)in query expression 'Street address = "".

This only comes up on some of the fields. Do you know what may be causing this?

Mally.



Imar December 9th, 2005 09:08 AM

How does the entire query look like? Maybe the error message is right, and there is an error in the SQL statement....

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.

malhyp December 9th, 2005 09:54 AM

Do you mean the query in Access? or this one in SQL

This did not work when testing
SELECT *
FROM Query1
WHERE Timber Species LIKE '%MMColParam%'

MMColParam 1 Request.Form("keywordSearch")

This worked for some reason
SELECT *
FROM Query1
WHERE Location LIKE '%MMColParam%'

MMColParam 1 Request.Form("keywordSearch")

Mally.

Imar December 9th, 2005 09:58 AM

It's because you have a space in the name of the column. This isn't recommended (for the reasons you just encountered) so it's best to rename the column to something like TimberSpecies.

Alternatively, wrap the column name in square brackets:

WHERE [Timber Species] LIKE bla bla bla.

Is this query the problem you contacted me about earlier?

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.

malhyp December 9th, 2005 10:30 AM

This has fixed part of the problem, the error message that used to come up every time Id test the recordset,.

So with this SQL thanks Imar, I can now search on the search page using one text field.

To create the advanced SQL so that the other two List/Menu work in the same search, should I do similart or add to this SQL?

SELECT *
FROM Query1
WHERE TimberSpecies LIKE '%MMColParam%'

MMColParam 1 Request.Form("keywordSearch")

Mally



All times are GMT -4. The time now is 03:40 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.