473,414 Members | 1,823 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

How to get pass number varible in the sql query in where option

pls help

In Table X (Of MsAccess DAtabase)
Y = Numbers

Query = Select Z,Y from X where Y= ?

Wherever i pass a var in y it gives me data type mismatch error ]
pls help
Oct 12 '06 #1
2 2262
willakawill
1,646 1GB
pls help

In Table X (Of MsAccess DAtabase)
Y = Numbers

Query = Select Z,Y from X where Y= ?

Wherever i pass a var in y it gives me data type mismatch error ]
pls help
What is the variable type in the database? In design mode if you click on the name of the field you will see in the properties box below.e.g. Long Integer
The variable you pass in the query must match this type.

Expand|Select|Wrap|Line Numbers
  1. Dim lngY As Long
  2. Dim stQuery As String
  3.  
  4. lngY = 12345
  5. stQuery = "SELECT Z, Y FROM X WHERE Y = " & lngY
  6.  
Oct 12 '06 #2
What is the variable type in the database? In design mode if you click on the name of the field you will see in the properties box below.e.g. Long Integer
The variable you pass in the query must match this type.

Expand|Select|Wrap|Line Numbers
  1. Dim lngY As Long
  2. Dim stQuery As String
  3.  
  4. lngY = 12345
  5. stQuery = "SELECT Z, Y FROM X WHERE Y = " & lngY
  6.  
thanx it never clicked me u can do this thanx a lot sometime ur get blocked
Oct 21 '06 #3

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

Similar topics

6
by: uitbundig | last post by:
I am writing a function as listed below. My problem is that this form passes only the variable 'state' and not the others. Can somebody help me? Thanks, Gustaaf function...
1
by: Abby Lee | last post by:
I hard coded "TheYear" (the table) and "MonthPD" (a field) into my script to make sure the query worked (it did)...so now I want to replace an actual year (table) with varible which the next step...
3
by: Don Seckler | last post by:
I have a data entry form called Draw. This form is used to enter data in the table called Draw. The table has the following fields: WholesalerID, MagID, IssueID, CopiesDist, and the index is...
0
by: Zlatko Matić | last post by:
Hi everybody! Recently I was struggling with client/server issues in MS Access/PostgreSQL combination. Although Access is intuitive and easy to use desktop database solution, many problems...
10
by: John Bailo | last post by:
I want to pass a SqlCommand object as a input parameter to a method. I want to pass the SqlCommand "by value" so that any updates to the original object are *not* reflected in the object within...
4
by: Phillip Vong | last post by:
I'm a newbie using VS2005 to learn and test. I'm testing against the Northwind DB. I created a simple variable called "myVariable" and I assigned it the character "c". I want my SQL query to use...
1
by: Greg Strong | last post by:
Hello All, Why would brackets be added to the SQL of a pass through query to Oracle? If I paste the debug print of the SQL statement into SQLPlus of Oracle's XE edition it works, and does NOT...
1
by: anniefs | last post by:
hi help me i m so much stuck int he code and i have no time .... i used ASP VBscipt and javascript functions with MS database javascript function add records in MS DB by using ASP vbscript...
3
by: Sachin | last post by:
Hi Folks, I have one query in regarding const varible interpretaion by C/C++ compiler. How Compiler actually differentiate between normal stack varible and const varible during program execution?...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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,...
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...

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.