Running Access Stored Queries With Parameters
I'd like to transfer al my hard coded sql queries to access stored queries and use them with parameters. Actually, I did not find any strong information how to do that. Please, provide me official information, or give me at least one example of using it(with
Select statement or other).
View Replies
ADVERTISEMENT
I have an access DB that has some queries built in to it.
Rather than putting the SQL in to my ASP Code (which I normally do) I was hoping there is some way to run the queries which already exist in the queries portion of the access DB. The queries do require me to input a variable though.
For example, there is one query called qry_FillForm which required me to pass a value called FormID (number)
If I have the value for FormID in my asp code, is there a way I can simply get this query to run? I can always create a
strSQL string and do it that way, I was just wanting to learn if it is even possible simply call the query that is alreay in the DB without having to manually put the SQL into my asp code.
View Replies
View Related
I am running the following code to an access database
' Recordset Object
Dim rs
' connecting to database
con.Open connStr
' executing stored procedure
Set rs = con.Execute ("exec SpotDesc")
' showing all records
While Not rs.EOF
Response.Write rs(0) & " " & rs(1) & "<br>"
rs.MoveNext
Wend
' closing connection and freeing resources
con.Close
Set rs = Nothing
This works and runs the stored procedure SpotDesc.
One question I have is that this line brings back the results
Response.Write rs(0) & " " & rs(1) & "<br>"
but requires me to know how many colums are being returned, ie rs(0) is column 1 and rs(1) is column 2
Is there a way of writing this line and it places all the columns there wheter it be 1, 2, or 3?
Ie a way of know how many columns are returned...
Is there also a way to show the column heading?
View Replies
View Related
I have several parameters that I need to pass into a stored procedure. Each parameter holds a comma delimited list.
I tried splitting the parameters and executing the stored procedure doing the following:
Dim CmtIdLoop
CmtIdLoop = Split(Request.Form("commentsID"),", ")
revwStatLoop = Split(Request.Form("review_status"),", ")
abrstatLoop = Split(Request.Form("abr_status"),", ")
commentsLoop = Split(Request.Form("comments"),", ")
For l = 0 to Ubound(CmtIdLoop)
s = CmtIdLoop(l)
t = revwStatLoop
u = abrstatLoop
v = commentsLoop .....
View Replies
View Related
I have developed a Stored Procedure on SQL Server 7 this is it:
ALTER PROCEDURE TestOutput
@FieldReturnedint=0 OUTPUT
AS
select @FieldReturned = 12
--print @FieldReturned
return 1001
and made a test ASP page to call this procedure on ASP page
<%
Dim CommObj, ParmObj, rsResults, strColumns
set CommObj = Server.CreateObject("ADODB.Command")
set rsResults = Server.CreateObject("ADODB.Recordset")
strColumns = 1
'rsResults.Open "TestOutput " & strColumns ,Conn
CommObj.ActiveConnection = Conn
CommObj.CommandText = "TestOutput"
CommObj.CommandType = adCmdStoredProc
'CommObj.Parameters.Refresh
'CommObj.Parameters.Append CommObj.CreateParameter("@Data", adInteger,adParamInputOutput)
'set ParmObj = CommObj.CreateParameter("@FieldReturned", adInteger, adParamOutput,, 1)
'CommObj.Parameters.Append ParmObj
Set ParamOut=CommObj.CreateParameter("@FieldReturned", adInteger,adParamInputOutput ","0")
CommObj.Parameters.Append ParamOut
'Set ParamRet=CommObj.CreateParameter ("Return",adInteger ,adParamReturnValue )
'CommObj.Parameters.Append ParamRet
'CommObj.Prepared = true
set rsResults = CommObj.Execute()
'strColumns = CommObj.Parameters("@FieldReturned").Value 'CStr(ParmObj) '
Response.Write "Returned Columns:[ " & CommObj.Parameters(0).Value & " ]"
%>
yet.......it does not type the output parameter......
it does not give an exception...just empty value for the output parameter
What do you think the problem is....?
View Replies
View Related
I'm having trouble calling a stored procedure. For some reason I keep getting this error.
--------------------------------------------------------------------
ADODB.Command error '800a0bb9'
Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.
---------------------------------------------------------------------
Here is the code: .....
View Replies
View Related
there used to be a script by Bob Barrows which generated the vbscript for
a stored procedure. The web site isn't there any more. Can anyone point me
somewhere else?
View Replies
View Related
I have a stored procedure that takes parameter @description with datatype set to text.
In my ASP I have the following:
..Parameters.Append
..CreateParameter("@description",adVarChar,adParamInput,255,varDesc))
I've seen other examples of SPs with adVarChar set to 1000 and up! Is this the way it should be done or is there a matching parameter type I should be using?
View Replies
View Related
I am having a problem running an sql stored procedure with ADO/ASP. If I hard code a select statement, the code works, but when I try to use a stored procedure it bombs. Here is my code:
THIS WORKS:
sql="SELECT PartNumber FROM Scrap WHERE DateOpened BETWEEN '20030601', '20030605'"
'Note: I already did my connection object above
set rs=Server.CreateObject("ADODB.Recordset")
rs.Open sql,conn
THIS DOES NOT:
'my stored procedure is LC_Top50_ByCost sql="LC_Top50_ByCost 'DB', '20030601', '20030605'"
set rs=Server.CreateObject("ADODB.Recordset")
rs.Open sql,conn
HERE IS THE ERROR:
Error Type:
ADODB.Recordset (0x800A0E78)
Operation is not allowed when the object is closed.
/MyWeb/T10_Cost.asp, line 202
Line 202 is the first line that I try to access the data in the
recordset.
View Replies
View Related
I've just written a fairly complex stored procedure to update several databases at once and I need to run it in my asp code. It has two inputs, @userid and @partcode
previously I've ran stored procedures as follows: Code:
View Replies
View Related
I never ever thought about this, but recently I made a query in access so I
can make a customer mailing list based on relational information and it was
so easy to make the query and join tables and assign criterea using access.
And I haven't tried or thought about this cause in my own small asp projects
I've never used a dbase with queries in it, but after seeing how easy it
was, it would save a lot of time from manually writting queries in asp.
So, what I'm asking is if I can use a query from an mdb in asp just like I
can access tables?
View Replies
View Related
I know that asp can be used to fire off stored procedures within databases, but I was wondering - does a 'query' in Access mean the same thing as stored procedure? If it does, how could I get asp to fire off that procedure when needed?
View Replies
View Related
We have an Access data base with severl tables, queries and forms.We want to put it on the web.Is there a tool that will convert the Access queries and forms to ASP?Sorta like "splitting" the database... but instead of an Access FrontEnd... have an ASP front end?
View Replies
View Related
I have a created a cost reporting system which shows a level-breakdown
report. There are three levels in the report the lowest level holds the cost
items that are entered by the user these records also have an Entry Date.
The level above that is a Sum of the lowest level and the top level is the
Sum of the second level. I created the solution using three queries in
Access. I then use the queries in ASP to generate the report. But now I need
to use the Entry Date at the lowest level to re-generate the report with
values from the StartDate to the EntryDate (which is entered by the user).
Question is, can I do this using the construction I use, or do I have to
pull my queries to the ASP code and include the dynamic EntryDate? How do I
solve this?
View Replies
View Related
I have an application, which simply consists of an Access database being queried by ASP code in a website, running on a Dell PowerEdge 1650 rack mount server (Pentium III 1.4 GHz) with 1024 MB ram. The server runs Windows 2000 5.00.2195 with Service Pack 4.
The application presents HTML tables to users, based on queries made by the user on the website.
Problem is: recently the construction of these tables has been very slow and the scripts time-out. The script timeout is set to about 3 minutes.
The application has been running for 2 years without any problems, well one. About 6 months ago the same thing was happening. I compacted and repaired the database - did not fix it. However on restarting the server it was back to normal, producing the tables immediately.
Now that the same problem is occuring again, neither a restart or a shutdown-restart fix the problem. The straight HTML part is served immediately, but it is evident that it chokes on the tables.
There are two other applications on the same server written in the same style, but much more simple. They are working fine. Code:
View Replies
View Related
I know vb quite well now, but asp have only started in the last couple of days.
I realise that it is not possible to create a report in Access through asp (nor in vb) but i know it is possible to run the report. Therefore, has anybody know how to run reports through ASP?
I have found one web site that is seems useful, but i want to compare that code to anybody elses. If you have some code that does this then please post, as i need to get a better understanding.
View Replies
View Related
I want to do a running total query , here is what i want :
I want the running total like this:
View Replies
View Related
I am currently using Microsoft access database 2000. I am trying to create a stored procedure in my database. How do i do that?
example:
"CREATE PROC procProductsAddItem(inProductName VARCHAR(40), " & _
"inSupplierID LONG, inCategoryID LONG) " & _
"AS INSERT INTO Products (ProductName, SupplierID, CategoryID) " & _
"Values (inProductName, inSupplierID, inCategoryID);""CREATE PROC procProductsUpdateItem(inProductID LONG, " & _
" inProductName VARCHAR(40)) " & _
"AS UPDATE Products SET ProductName = inProductName " & _
" WHERE ProductID = inProductID;"
View Replies
View Related
A client has an OLE field called Signature in an Access database. The field contains a GIF image of a scanned signature (that a product has been received). How can I show this on an ASP page?
View Replies
View Related
A client has an OLE field called Signature in an Access database. The field contains a GIF image of a scanned signature (that a product has been received).
How can I show this image on an ASP page?
View Replies
View Related
I have a stored access query which is corresponding to a particular id. However, I am using a login script to capture the value of an id. Now, I want to dynamically open the stored query by passing the id captured via login.
Which means, I need to erase the static id value associated with the stored query GMISExpenseCombo. how do i open this stored query by passing the id value to the stored
query. I am using this stored query to retrieve some financial data for the corresponding record. Currently, I am opeing the static stored query as follows RS.Open "GMISExpenseCombo"
View Replies
View Related
my stored procedure in access XP (I create it Succesfully)
It returns me all records.. For example in my db there are records with
catid=1 but no record with id=2
I try my code both catid=1 and catid=2 it returns same records.. What is my
fault..? Code:
View Replies
View Related
Currently, I do the following in my ASP pages when making use of an MS
Access database:
Dim adoCon, rsSet, strSQL
Set AdoCon = server.CreateObject("ADODB.Connection")
Set RsSet = Server.CreateObject("ADODB.RecordSet")
adoCon.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
Server.MapPath("MyDB.mdb")
strSQL="SELECT * FROM MyTable;"
rsSet.Open strSQL, adoCon
...do some stuff...
rsSet.Close
adoCon.Close
Set rsSet=Nothing
Set adoCon=Nothing
I have a couple queries stored in the database that I use when in MS Access.
Can I call these queries instead of using a string to specify the SQL
command?
The above seems kind of verbose for making use of a database. Can it be
simplified at all?
View Replies
View Related
Anyone know how to read excel file with ASP and stored it in database?
View Replies
View Related
I'm pasing a zip code as a prameter to an Access stored procedure. In
Access the parameter is a text data type. It works for non-leading zero
zip codes but, apparently access (or ASP) is converting it to a value
first (dropping the zero) then sending that to my SP.
Even if I use cStr() to be sure the parameter is sent a string it still seems to drop
the leading zero. Any thoughts? Note: It needs to be a string for canadian zip
View Replies
View Related
anyone know how to open in ASP a word .doc stored in an access database.
View Replies
View Related
I am trying to peform a multiple deletion of records from a single table "Stockist"
I i keep getting the following Error and can't see where i am going wrong. Can anyone help?
Microsoft OLE DB Provider for ODBC Driverserror '80040e10'
[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 2.
/RetailerStockProductRemove.asp, line 22
The code i have used is as follows:
View Replies
View Related
I have a client who has had a ASP site with an Access database for several years. It stores information for the used cars on his lot. I have stored text in the database that points to the location of the image for each record. Each record will have a thumb image that is supposed to display in a list of vehicles available then the user can select an item from this list and a new page displays with the information and the regular size image. So far everything has worked fine exept for the display of the images which are stored in a separate directory called veh-photos. All I get are image place holders. I am using Dreamweaver 2004 and and Access 2000 for the database.
Following is the code to list vehicles: ....
View Replies
View Related
Normally I use Access database with ASP, and I create queries using the wizard which Access has. Then, I copy and paste the code in the ASP page and create my SQL.
I was wondering if it is easier to call the query directly with its name from Access, or else continue using the old procedure.
View Replies
View Related
I'm trying to build sql queries that will search through my DB. I am currently seperating my queries through multiple indexes in an array depending on whether or not the strings are wrapped in quotations.
I also want
Fluffy
Teddy
Bear
(three different LIKE statements)
View Replies
View Related
I have the following page which I am using to select 3 diffrent queries but i was wondering if i could just use one SQL statement instead of 3? Code:
View Replies
View Related
Say I have 5 fields in a form. I have figured out how to query a database using all 5 fields and display the records that match at least one of the fields.
I'm trying to figure out a way to, if say the user only fills in two fields, to only search the database for matching records based on just the two fields. As I have it now, the database is searched for the two fields they entered as well as three fields of "", which I would rather not have. Is this possible?
View Replies
View Related
I have a DB. With 1 table called "products" and 3 product records. The 2 fields present in the table are called product_name and product_price. The names of the products are Product1, Product2 and Product3. They cost 13, 8 and 24. Which code (SQL and AP) would generate an output similar to this?
Total is: 45.
Product1 costs 13
Product2 costs 8
Product3 costs 24.
<%
SQL = "Select * FROM products" (plus some kind of sum function to calculate the total (to be able to display the sum before the various products) of the recordset without having to loop through the recordset first)
%>
View Replies
View Related