473,769 Members | 5,787 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How do multiple select statements

4 New Member
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 2234
Killer42
8,435 Recognized Expert Expert
... 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 Recognized Expert Top Contributor
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 Recognized Expert Expert
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
golffor1
4 New Member
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 Recognized Expert Expert
Try using

objCommand.Comm andText = "Select * from table where number =" & Val(txtSearchLi st.Text)

No need of this at all
objCommand.Comm andText1 =.........

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
golffor1
4 New Member
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 Recognized Expert Expert
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
11750
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 (@rowct > 0) begin
4
1705
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 are the SELECT statements I want to combine: SELECT * FROM schoolrequest WHERE SLid=10 SELECT SLlastName FROM academicoffice WHERE schoolrequest.SLsendToId=academicoffice.AOid
3
7736
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 @Type='Rushing'> <LEADER @Carries=''/> </LEADERBOARD> <LEADERBOARD @Type='QBRating'> <LEADER @Rating='' @CompletionPct=''/>
7
6168
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 'patch' in an mdb file and use say ado or even a passthrough statement to execute it. The problem I've got Is I access (?) seems to require me to execute one ddl at a time, otherwise the script breaks at the 'go' statement. While I _could_ do...
2
3130
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 individually, but not together, Access help is as much use as a chocolate fireguard in this case! any suggestions or explainations would be gratefully appreciated:
3
2169
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 following: Dim queryString As String = "SELECT TOP 1 (.), . FROM WHERE (. = @LessonID) AND .='Motivate'; SELECT TOP 1 (.), .
1
21687
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 "01" : dWarrExpDateMonth="Jan" : dRetailDateMonth="Jan" case "02" : dWarrExpDateMonth="Feb" : dRetailDateMonth="Feb" End Select
7
20332
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, if they do not already exist. In terms of ASP/ADO, that would be fine in a SQL Server Sense by a simply ASP/Server-Side JavaScript as such: var cnTemp = Server.CreateObject("ADODB.Connection");
2
5096
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 a new Data Source to to my VB 2005 project, and point to this stored procedure, the data source wizard only sees the 'first' select statement. Is there a way to load multiple tables in a DataSet from a single stored procedure with multiple...
3
8621
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 statements each of which 'unloads' to its own unique file. unload to 'file1.txt' select * from ...... unload to 'file2.txt' select * from ...... and so on....
0
9583
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
9423
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,...
1
9990
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
8869
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6668
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
5297
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
5445
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3955
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
3
2814
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.