473,386 Members | 1,799 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,386 software developers and data experts.

How do multiple select statements

Hello I was wondering if you could help me out with doing multiple select statements.

I have this
Expand|Select|Wrap|Line Numbers
  1.  objCommand.CommandText = "Select * from table"
  2.     objCommand.CommandText1 = "Select * from table where number like" & Val(txtSearchList.Text)
  3.     objCommand.CommandTimeout = 30
  4.     objCommand.CommandType = adCmdText
  5.     Set objRS = objCommand.Execute
  6.     Set objCommand = Nothing
  7.     Do Until objRS.EOF
  8.            Reference(Number) = objRS("Number")
  9.         Number = Number + 1
  10.         objRS.MoveNext
  11.     Loop
  12.     objRS.Close
  13.     Set objCommand = Nothing
  14.     Set objRS = Nothing
  15.     Number = Number - 1
  16.     For display = 0 To Number
  17.            lstVoucherAmt.AddItem Reference(display)
  18.     Next
  19.  
The line that is in bold is the one I am having trouble with. THen I want it to put the value it finds from the second select statement, into another box. Do you have any suggestions on how to do this?
Mar 5 '08 #1
7 2216
Killer42
8,435 Expert 8TB
... THen I want it to put the value it finds from the second select statement, into another box. Do you have any suggestions on how to do this?
I don't get it. Why can't you just perform the same process again for the second query?
Mar 6 '08 #2
QVeen72
1,445 Expert 1GB
Hi,

What error you are getting...?
And you have to use "Like" Operator on Strings, not on Numeric Fields..

Regards
Veena
Mar 6 '08 #3
Killer42
8,435 Expert 8TB
Good catch, Veena.

Yes, the Like operator is used to match strings using wildcard characters. It's not applicable to a number. You probably should be using the = operator.
Mar 6 '08 #4
if I use the = I get a n error that states:

method or data member not found.

What I want to do is...what the second sql statement finds I want to put in the text a text box. I don't know how easy this is?
Mar 7 '08 #5
debasisdas
8,127 Expert 4TB
Try using

objCommand.CommandText = "Select * from table where number =" & Val(txtSearchList.Text)

No need of this at all
objCommand.CommandText1 =.........

Try to change the field name in database. Don't use Number as field name. That might create some problem. As that is a key word.
Mar 7 '08 #6
I think the issue there is I am not able to change the database. So I have to use number, if I change the field then it could mess with the store procs in sql.
Mar 7 '08 #7
debasisdas
8,127 Expert 4TB
I think the issue there is I am not able to change the database. So I have to use number, if I change the field then it could mess with the store procs in sql.
Then try changing the code as suggested in post #6.
Mar 7 '08 #8

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

Similar topics

8
by: MrTrix | last post by:
Hello: I'm having a problem formulating the code to execute a multiple line command. I'm trying to execute something like: set rowcount 100000 declare @rowct int select @rowct = 1 while...
4
by: ctoth | last post by:
I'm writing an ASP page for a project and it requires multiple queries. However, I'm trying to combine multiple SELECT statements, but can't figure out a way that actually works. Basically, here...
3
by: Mark Miller | last post by:
I have an sp that outputs multiple xml fragments w/ no root. The sp calls individual sp's to output the correct set of data and each "type" has different fields. ex.: <LEADERBOARD...
7
by: Glenn Davy | last post by:
Hidely hodley everyone I'd like to run a series of of sql ddl statements against an msde2000 server. Normally I just deploy cmd file that impliments as osql statement, but I'd like to store the...
2
by: Annie D via AccessMonster.com | last post by:
Hi, Is it possible to use multiple statements in SQL?? (I’ve never used it before) : I have one query that i'm working with, The statements I want to use are as below, they all work...
3
by: Joe via DotNetMonster.com | last post by:
Hi, I'm trying to use several select statements so that I don't need to call the function several times. The next Result set always seems to read the first select statement. I have the...
1
by: microsoft.public.dotnet.languages.vb | last post by:
Hi All, I wanted to know whether this is possible to use multiple variables to use in the select case statement such as follows: select case dWarrExpDateMonth, dRetailDateMonth case...
7
by: =?Utf-8?B?QVRT?= | last post by:
HOWTO Run multiple SQL statements from ASP/ADO to an Oracle 10g. Please help, I'm trying to write an ASP page to use ADO to run a long query against an Oracle 10g database, to create tables,...
2
by: =?Utf-8?B?VGVycnk=?= | last post by:
I have coded multiple select statements in a single stored procedure, and when I execute this procedure on SQL Server Management Express, I correctly get multiple result sets. But, if I try to add...
3
by: Tim | last post by:
Hi Folks, I'm used to a UNLOAD command that allows me to dump to a named flat file the results of any SELECT statement. Hence one can build a single SQL file which contains multiple SQL...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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
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...

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.