Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Front_end for SQL query

Author  Topic 

cmh
Starting Member

20 Posts

Posted - 2004-04-06 : 10:47:22
We currently have a query running against an Access db. There is a [Criteria] field that is entered before the query, passed on to the query, and records selected from the db according to this field. This [criteria] field is the users name. The query uses this name to select records from the db. I need to run this same type of process against a SQL db. The problem seems to be that SQL does not have anything like a [criteria] field that can be passed to the query. I need to select records by this [criteria] field. Is there anyway to do this in SQL similar to Access without having to program a page in ASP or something? If I have lost you sorry. I am new to SQL, have never used Access, and can write a simple ASP program. Thank you for any help.

samsekar
Constraint Violating Yak Guru

437 Posts

Posted - 2004-04-06 : 11:04:13
READ BOL (Start > Programs > Microsoft SQL Server > Books onLine)
Search for Topic 'SELECT'

- Sekar
Go to Top of Page

AjarnMark
SQL Slashing Gunting Master

3246 Posts

Posted - 2004-04-06 : 17:02:34
When you mention a [Criteria] field, what you're really talking about is the WHERE clause of the SELECT statement (the syntax of which Sekar is pointing you to). If you are using Access as the front-end to connect to your SQL Server tables as Linked Tables in Access, then you can still use the same query designer built into Access, and you can switch the view to see the SQL code that the query designer is building to help you understand that, too.

What front-end are you using to issue your query?

--------------------------------------------------------------
Find more words of wisdom at [url]http://weblogs.sqlteam.com/markc[/url]
Go to Top of Page

AjarnMark
SQL Slashing Gunting Master

3246 Posts

Posted - 2004-04-06 : 17:47:07
cmh emailed me saying...
quote:
That seems to be the problem. I have created a database results button using FrontPage 2003. I insert the query here and save the page. The query will run, but since there is nothing prompting for the LastName, the script breaks down at that point.

I prefer not to answer individuals questions via email. Posting your follow-up questions here in the forum helps others who are reading and may have similar issues or just want to learn more, so I'm bringing the discussion back here.

Now, I have no clue what a "database results button" is. I'm familiar with FrontPage, and I've done my fair share of ASP development with SQL Server, but I don't understand your point. Are you using ASP? Are you trying to use some sort of connected recordset? I do all my development in ASP using ADO Connection, Command, and Recordset objects. Typically I would put the query into a stored procedure that has one or more parameters that are passed in and used for filtering. Inside the stored procedure is the SELECT statement with the parameters appearing in the WHERE clause. You might want to read up on using stored procedures with ASP here and on http://www.4guysfromrolla.com

--------------------------------------------------------------
Find more words of wisdom at [url]http://weblogs.sqlteam.com/markc[/url]
Go to Top of Page

cmh
Starting Member

20 Posts

Posted - 2004-04-07 : 09:50:07
The Database Results Wizard in FrontPage helps retrieve information from a database and display it on the Web page. The wizard creates or embeds a query within the necessary server-side script to create the link between the Web page and the database. To select this function choose Insert - Database - Results. I don't know enough about ASP to try anything complicated with stored procedures and the like. I am not using ASP. I have created a FrontPage document and it brings in the necessary ASP code to make the database connection. I wish I knew ASP well enough to do what you have done.
Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2004-04-08 : 08:49:19
Go to the link Mark provided and start reading. How do you think any of us here got to know what we now?

Believe me, in a month's time, you will curse the name FrontPage and hold it in the lowest regard possible, as it should be.
Go to Top of Page

cmh
Starting Member

20 Posts

Posted - 2004-04-12 : 11:03:01
The issue has been resolved. FrontPage handles the connection and updating very nicely. Thank you for all of your help.
Go to Top of Page
   

- Advertisement -