473,790 Members | 2,437 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Pass through query from MS Access

I would like to call this stored procedure, but I am unable to pass
parameters to the @Start and @End.

Is thier a way to pass parameters to a pass through query from MS
Access?

SELECT COUNT(dbo.tblPe rsActionHistory .PersActionID) AS [Total Ct],
[dbo].fn_FindStartPa yPeriod(dbo.tbl PersActionHisto ry.PersActionID , 2)
AS [Signed PP]
FROM dbo.tblPersActi onLog INNER JOIN
dbo.tblPersActi onHistory ON
dbo.tblPersActi onLog.PersActio nID =
dbo.tblPersActi onHistory.PersA ctionID
WHERE (dbo.tblPersAct ionLog.StatusID BETWEEN 4 AND 7) AND
(dbo.tblPersAct ionLog.Rejected = 0) AND
(dbo.tblPersAct ionLog.IsPayAct ion = 0) AND
(dbo.tblPersAct ionHistory.Acti onTypeID = 5) AND
(dbo.fn_IsParAC orrection(dbo.t blPersActionHis tory.PersAction ID) = 0)
AND

([dbo].fn_ParNotExcep tion(dbo.tblPer sActionHistory. PersActionID) = 1)
AND (dbo.tblPersAct ionHistory.Item DTG >= @StartDate) AND
(dbo.tblPersAct ionHistory.Item DTG <= @EndDate)
GROUP BY
[dbo].fn_FindStartPa yPeriod(dbo.tbl PersActionHisto ry.PersActionID , 2)
Jan 2 '08 #1
2 3216
On Wed, 2 Jan 2008 05:06:50 -0800 (PST), gumby
<gu************ @cox.netwrote:

You have to replace the parameters before submitting the query.
sql = "select ..."
sql = replace(sql, @StartDate, "'1/1/2008'")
(note the single-quotes around the date)
sql = replace(sql, @EndDate, "'12/31/2008'")

-Tom.

>I would like to call this stored procedure, but I am unable to pass
parameters to the @Start and @End.

Is thier a way to pass parameters to a pass through query from MS
Access?

SELECT COUNT(dbo.tblPe rsActionHistory .PersActionID) AS [Total Ct],
[dbo].fn_FindStartPa yPeriod(dbo.tbl PersActionHisto ry.PersActionID , 2)
AS [Signed PP]
FROM dbo.tblPersActi onLog INNER JOIN
dbo.tblPersActi onHistory ON
dbo.tblPersAct ionLog.PersActi onID =
dbo.tblPersAct ionHistory.Pers ActionID
WHERE (dbo.tblPersAct ionLog.StatusID BETWEEN 4 AND 7) AND
(dbo.tblPersAc tionLog.Rejecte d = 0) AND
(dbo.tblPersAc tionLog.IsPayAc tion = 0) AND
(dbo.tblPersAct ionHistory.Acti onTypeID = 5) AND
(dbo.fn_IsParA Correction(dbo. tblPersActionHi story.PersActio nID) = 0)
AND

([dbo].fn_ParNotExcep tion(dbo.tblPer sActionHistory. PersActionID) = 1)
AND (dbo.tblPersAct ionHistory.Item DTG >= @StartDate) AND
(dbo.tblPersAct ionHistory.Item DTG <= @EndDate)
GROUP BY
[dbo].fn_FindStartPa yPeriod(dbo.tbl PersActionHisto ry.PersActionID , 2)
Jan 2 '08 #2
gumby (gu************ @cox.net) writes:
I would like to call this stored procedure, but I am unable to pass
parameters to the @Start and @End.

Is thier a way to pass parameters to a pass through query from MS
Access?
I really hope there is. Unfortunately, this is an SQL Server forum
and not an Access forum, so it's not the best place for advice.

As long as the queries are submitted through ADO you can use
..CreateParamet er to specify the parameters. But I don't know if
what is meant with pass-through queries. (I have no experience of
Access myself.)

You are probably better off asking in an Access forum. But what I can
say from the SQL Server side of things is that you should never expand
parameter values directly into the query string, but always use
parameterised commands. There are three reasons for this:

1) If you expand the parameters, each new parameter values results in
a new cache entry, resulting in higher load on SQL Server for
compilation and memory.
2) Parameterised commands protects you against SQL injection, that is
a user entering data which affects the SQL syntax.
3) No problems with date values. For instance the snippet that
Tom van Stiphout will not work for French, German or British users.

So if pass-through queries in Access actually do not support parameters,
the answer is simple: don't use them.

--
Erland Sommarskog, SQL Server MVP, es****@sommarsk og.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Jan 2 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1953
by: Cady Steldyn | last post by:
Example: Date | ItemCode | Stock_In_qty | Stock_Out_qty | Bal_qty ------------------------------------------------------------------ 12/09/2003 | A100 | 20 | 0 | 20 25/10/2003 | A100 | 0 | 10 | *10 I need to query an Access database that will take field 3 (Stock_In_qty) plus any bal from
4
14248
by: Corey | last post by:
All, I am relatively new to XML and I have what may sound like a dumb question. I want to pass a query string variable to my xml document and filter the output based on that variable. For example, if I type in www.mysite.com?geid=0000123468 I want to display only AccessReview/Report where GEID='0000123468'. I appreciate any help you can provide. Corey
1
13015
by: TErnst | last post by:
Hello All.... What I am attempting to do is have a link/button on a page (testpopup.cfm) that opens a popup page (popupwindow.cfm). The popup page displays a resultset from a query and the selected record needs to be passed through a query string/URL parameter to the original calling page and will be available in the body onload event of the calling page. I open the popup window and display the query results, I then click on
4
4817
by: news-server.tampabay.rr.com | last post by:
Hi, Below is a stock script I found which controls a framed environment. My problem is that if a URL has a query string attached, that string does not pass through. Can someone please let me know if and hopefully how, it will be possible to carry a query string through? This first part here is in the default.asp framed page. <SCRIPT LANGUAGE="JavaScript">
15
7191
by: deko | last post by:
I need a way to create a table with a programmatically defined name. I have a Make Table query that will create the table with the name that I put in the query, but I don't know how to (or if I can) use a function to pass the table name into the query. Here is the basic form of the Mke Tble query: SELECT TxDate, Amount, Tx_ID, TxAcctName, INTO FROM tblTxJournal;
2
3511
by: P Adhia | last post by:
Hi, I am trying to understand why following simple query is running very slow (33 hours) select ROW_ID , a.CREATED , a.CREATED_BY , a.LAST_UPD , a.LAST_UPD_BY
7
7358
by: rguarnieri | last post by:
Hi! I'm trying to create a query with a boolean expression like this: select (4 and 1) as Value from Table1 this query return always -1, but when I make the same calculation in visual basic, the value returned is 0. Can anyone tell me why the expression (4 and 1) return different value
12
2166
by: Kevin Blount | last post by:
I'm having a very odd issue, that arose this morning after working fine yesterday... here's a very simple script: 1: <?php 2: $test = $_GET; 3: echo "Hello" . $test . "<p>"; 4: ?>
8
3026
by: Rich P | last post by:
(this is way easier in VB.Net -- but here is how to do it from Access) '------------------------------------------------ Public Declare Function apiShellExecute Lib "shell32.dll" _ Alias "ShellExecuteA" _ (ByVal hwnd As Long, _ ByVal lpOperation As String, _ ByVal lpFile As String, _ ByVal lpParameters As String, _ ByVal lpDirectory As String, _
5
9139
by: lisles | last post by:
i have a page funtion.php which hs the function to connect to the db /* Mysql Connection */ function connect(){ global $db_server,$db_user,$db_pass,$db;//Global Values from the config.php $conn = @mysql_connect($db_server,$db_user,$db_pass) or die("Connection to Database Server Failed"); @mysql_select_db($db) or die("Database Selection Failed"); return $conn; }
0
9666
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9512
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10200
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10145
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6769
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5422
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5551
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4094
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3707
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.