Hello I was wondering if you could help me out with doing multiple select statements.
I have this -
objCommand.CommandText = "Select * from table"
-
objCommand.CommandText1 = "Select * from table where number like" & Val(txtSearchList.Text)
-
objCommand.CommandTimeout = 30
-
objCommand.CommandType = adCmdText
-
Set objRS = objCommand.Execute
-
Set objCommand = Nothing
-
Do Until objRS.EOF
-
Reference(Number) = objRS("Number")
-
Number = Number + 1
-
objRS.MoveNext
-
Loop
-
objRS.Close
-
Set objCommand = Nothing
-
Set objRS = Nothing
-
Number = Number - 1
-
For display = 0 To Number
-
lstVoucherAmt.AddItem Reference(display)
-
Next
-
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?
7 2234
... 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?
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
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.
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?
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.
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.
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.
Sign in to post your reply or Sign up for a free account.
Similar topics |
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
|
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
|
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=''/>
|
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...
|
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:
| |
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 (.), .
|
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
|
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");
|
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...
|
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....
|
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...
| |
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,...
|
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,...
|
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...
|
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();...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
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
|
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...
| |