473,473 Members | 2,167 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How to pass a variable to a query?

5 New Member
I want to enter a url of the form "http://www...../index.htm?MC001" and pass the "MC001" to a query string. The query string I have now is:
Expand|Select|Wrap|Line Numbers
  1.  qry = "SELECT QRID, QRContent FROM " & tablename & WHERE QRID= '" & request.querystring() & "'"
  2.  
Why does this not work?
Jan 28 '11 #1
1 1938
Frinavale
9,735 Recognized Expert Moderator Expert
It doesn't work because you need to specify the variable to retrieve from the QueryString.

Right now you have no variable name defined...which is your first problem.

Your query string should look like
Expand|Select|Wrap|Line Numbers
  1. "http://www...../index.htm?idCode=MC001"
Now you can retrieve "idCode" from the QueryString to get MC001:
Expand|Select|Wrap|Line Numbers
  1. Dim idCode As String = Request.QueryString("idCode")
  2.  
-Frinny
Feb 7 '11 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: bpschmid | last post by:
Ive got a datagrid with a hyperlink column. I want to click on that column and go to another page, but here's the kicker, I need and want to pass not one, but two different query string parameters...
1
by: Lisa | last post by:
I have an excel file on my server, which contains an embedded query. I want to be able to open the excel file, pass the contents of my variable into a cell within the worksheet and then refresh the...
2
by: John Aspinall | last post by:
Hi, Ive got a navigation bar for my web pages in an include (top_nav.asp). On my homepage (index.asp) and all the other site pages I have a reference to this include which includes my...
10
by: Geoff Cox | last post by:
Hello, I have written before that I can pass a variable from page 1 to page 2 if I call the variable "name". Stephen Chalmers has written, >'name' is effectively a reserved word as the...
2
by: MX1 | last post by:
HELP! I have a query that gets a few values from a form. The problem I'm having is a date field in the query. When I put the value in the criteria, it works fine. When I put the same value as...
4
by: Regnab | last post by:
How can I pass a variable (Dim Property As String) to the query criteria? I figure I could do it the long way and send it to a form and have the query access it from there but I figure there has...
5
by: glenn | last post by:
Hi folks, The problem I have is that a query string works if hard-coded but if I pass a variable to it, it does not work as shown here. This works: querystring="SELECT * FROM USERS WHERE...
0
by: kencana | last post by:
hi All, I got problem in passing data (more than one) from soap client to the soap server. but if i only passing one data at a time, it works successfully.. The following is the error message i...
1
by: shaiful | last post by:
Hi all, I have a problem with report in vba. I using vba report with access database. my query is: "select name, Roll, Adress from Stdinfo where id=Variable Here from form]" so how i can pass...
9
by: d4zza | last post by:
I'm using Access 97 SR-2 on Windows XP to develop an Inventory style database that has some functionality, but having a problem making my query dynamic. I have a switchboard style form which I...
0
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,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
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...
0
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 ...
0
muto222
php
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.