I am trying to achieve a similar query in ORACLE but donno how to do it in Ms SQL Server and MS Access (I have to do it for both these databases)
SELECT * FROM someTable
WHERE someField = &EnterValue
When this query is executed in ORACLE, it will ask user to enter value for &EnterValue and then execute the query using the user entered value.
Can this be done in MS SQL Server and MS ACCESS?
Please help...
ThanksHi-
Found the answer for MsAccess, I need to enter =[EnterValue] in Criteria for a given column.
Still looking for answer for MS SQL Server. Is Stored Proc the only answer?
Please help...
Best Wishes,|||SQL Server will not prompt the user for a parameter value. It needs to be supplied.
It is normally done like this:
SELECT * FROM someTable
WHERE someField = @.someValue
and Parameters are used to provide the query with the parameter value that the user has input from a data entry screen. You do not necessarily need a stored procedure to accomplish this (although I believe that is the best way).
Check out the ASP.NET tutorialServer-Side Data Access, especially the "Performing a Parameterized Select" section, to see how to use Parameters with ADO.NET.
Terri
No comments:
Post a Comment