Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Parameter Syntax

Status
Not open for further replies.

caconner

Technical User
May 20, 2002
42
US
I'm creating an internal web app with ASP.NET and Access. After some reading, I've found that the best way to set this up is with stored queries. Never worked with them, but I want to make sure they are set up properly.

Is there any function difference between using the [parameter:] as opposed to the @parameter? The brackets are used more, however I've seen many ASP.NET examples that use the @.
 
stored procedures in Access?? I havent heard of that...may be you are referring to stored procedures in SQL Server...

now when you see @parameter, it is like a variable...for example inside stored procedure we do this...

Create Procedure myproc
AS
Declare @myvar as integer

SELECT count(*)=@myvar as blah from mytable...

and so on...

on the other hand this [parameter:] looks more like a access thing...

i think you are getting your thoughts mixed up here...

-DNG
 
No just my verbiage. I meant Access stored queries.

I know that SQL Server uses the @, but I've also seen it in a few articles on creating Access stored queries that are accessed by ASP.NET pages. Both methods work in Access 2000. I'm just wondering which syntax is better - if one is deprecated, or if there is a recommended method when used with ASP.NET.
 
ok. These jargons are always confusing...i think using [parameter:] is preferrable when compared to @parameter...

-DNG
 
I read that article already, which gave me pause, however I found others that used the @ symbol. The article also doesn't specific an Access version number so...

I definitely have gotten both methods to work. Right now I'm running Access 2000, but in the next few days I'm getting a new computer (yeah!!) and will most likely be running Access 2003. I know how MS likes to mix things up and I don't want to start using one if it has one foot out the door. Of course, I also don't want to use one if it acts blinky.
 
The article also doesn't specific an Access version number so... " - except specifically stating starting with Access 2000, or to quote from the first paragraphs "Stored procedures in Access have been available since Access 2000 and are native to the Jet 4 Database Engine".

When manipulating stored queries, or as this, "stored procedures" programatically, it seems you're sometimes able to get away with "@", just be aware, it might be dependant on version and should you ever open this stored query from within Access, or perhaps manipulate it from other sources, the "@" may invalidate the stored query. The [bracket] notation, or the syntax used in the article, should not suffer from such. This quote from the article says pretty much the same "Access doesn't always convert this character and will sometimes leave it out. This can cause esoteric bugs which can lead to premature hair loss.". Not that there's any specific mentioning of it, but in this Microsoft article, no @ is used either HOW TO: Create a Parameterized Jet Stored Procedure using DDL in Access 2000

Roy-Vidar
 
Well, I just wanted to be sure there wasn't some change in Access 2003 that would contradict this info.

Since you seem to be knowledgeable in this area... Is it not possible to pass the table name as a second parameter?

Thanks for your input!
 
Thank you.

As far as I know, not to a stored query, I think you'd need dynamic SQL to be able to "toggle" table.

Roy-Vidar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top