I am trying to add results of a query to a listbox. I have it working when
the query returns one record but I need more. I am used to working with
recordsets but I'm lost here in .net.
This is what I have but the query will return 2 SerialNumbers
Dim str As String
Me.OracleCommand1.CommandText = "SELECT SerialNumber FROM TAB_TEST
WHERE (ACTIVE = 'Y')"
Dim RS As Data.DataColumnCollection
str = OracleCommand1.ExecuteScalar
Me.cmbBox.Items.Add(str) 6 1952
You need to use a DataReader which works a little like a recordset.
This is C#, but hopefully you should get the gist...
OleDbDataReader dr = OracleCommand1.ExecuteReader();
while (dr.Read());
{
me.cmbBox.Items.Add(dr[0].ToString());
}
dr.Close();
Cheers,
Chris.
"Mike D" <Mi***@discussions.microsoft.com> wrote in message
news:0C**********************************@microsof t.com... I am trying to add results of a query to a listbox. I have it working
when the query returns one record but I need more. I am used to working with recordsets but I'm lost here in .net.
This is what I have but the query will return 2 SerialNumbers
Dim str As String
Me.OracleCommand1.CommandText = "SELECT SerialNumber FROM TAB_TEST WHERE (ACTIVE = 'Y')"
Dim RS As Data.DataColumnCollection str = OracleCommand1.ExecuteScalar Me.cmbBox.Items.Add(str)
You need to use a DataReader which works a little like a recordset.
This is C#, but hopefully you should get the gist...
OleDbDataReader dr = OracleCommand1.ExecuteReader();
while (dr.Read());
{
me.cmbBox.Items.Add(dr[0].ToString());
}
dr.Close();
Cheers,
Chris.
"Mike D" <Mi***@discussions.microsoft.com> wrote in message
news:0C**********************************@microsof t.com... I am trying to add results of a query to a listbox. I have it working
when the query returns one record but I need more. I am used to working with recordsets but I'm lost here in .net.
This is what I have but the query will return 2 SerialNumbers
Dim str As String
Me.OracleCommand1.CommandText = "SELECT SerialNumber FROM TAB_TEST WHERE (ACTIVE = 'Y')"
Dim RS As Data.DataColumnCollection str = OracleCommand1.ExecuteScalar Me.cmbBox.Items.Add(str)
Thanks for the reply. I get the gist just not the syntax.
If I add
Dim myReader As OracleDataReader = OracleCommand1.ExecuteReader()
I get a:
Type 'OracleDataReader' is not defined error??
Mike
"Chris Mayers" wrote: You need to use a DataReader which works a little like a recordset.
This is C#, but hopefully you should get the gist... OleDbDataReader dr = OracleCommand1.ExecuteReader(); while (dr.Read()); { me.cmbBox.Items.Add(dr[0].ToString()); } dr.Close();
Cheers,
Chris.
"Mike D" <Mi***@discussions.microsoft.com> wrote in message news:0C**********************************@microsof t.com... I am trying to add results of a query to a listbox. I have it working when the query returns one record but I need more. I am used to working with recordsets but I'm lost here in .net.
This is what I have but the query will return 2 SerialNumbers
Dim str As String
Me.OracleCommand1.CommandText = "SELECT SerialNumber FROM TAB_TEST WHERE (ACTIVE = 'Y')"
Dim RS As Data.DataColumnCollection str = OracleCommand1.ExecuteScalar Me.cmbBox.Items.Add(str)
Thanks for the reply. I get the gist just not the syntax.
If I add
Dim myReader As OracleDataReader = OracleCommand1.ExecuteReader()
I get a:
Type 'OracleDataReader' is not defined error??
Mike
"Chris Mayers" wrote: You need to use a DataReader which works a little like a recordset.
This is C#, but hopefully you should get the gist... OleDbDataReader dr = OracleCommand1.ExecuteReader(); while (dr.Read()); { me.cmbBox.Items.Add(dr[0].ToString()); } dr.Close();
Cheers,
Chris.
"Mike D" <Mi***@discussions.microsoft.com> wrote in message news:0C**********************************@microsof t.com... I am trying to add results of a query to a listbox. I have it working when the query returns one record but I need more. I am used to working with recordsets but I'm lost here in .net.
This is what I have but the query will return 2 SerialNumbers
Dim str As String
Me.OracleCommand1.CommandText = "SELECT SerialNumber FROM TAB_TEST WHERE (ACTIVE = 'Y')"
Dim RS As Data.DataColumnCollection str = OracleCommand1.ExecuteScalar Me.cmbBox.Items.Add(str)
Got it.
Thanks for the help
Mike
"Chris Mayers" wrote: You need to use a DataReader which works a little like a recordset.
This is C#, but hopefully you should get the gist... OleDbDataReader dr = OracleCommand1.ExecuteReader(); while (dr.Read()); { me.cmbBox.Items.Add(dr[0].ToString()); } dr.Close();
Cheers,
Chris.
"Mike D" <Mi***@discussions.microsoft.com> wrote in message news:0C**********************************@microsof t.com... I am trying to add results of a query to a listbox. I have it working when the query returns one record but I need more. I am used to working with recordsets but I'm lost here in .net.
This is what I have but the query will return 2 SerialNumbers
Dim str As String
Me.OracleCommand1.CommandText = "SELECT SerialNumber FROM TAB_TEST WHERE (ACTIVE = 'Y')"
Dim RS As Data.DataColumnCollection str = OracleCommand1.ExecuteScalar Me.cmbBox.Items.Add(str)
Got it.
Thanks for the help
Mike
"Chris Mayers" wrote: You need to use a DataReader which works a little like a recordset.
This is C#, but hopefully you should get the gist... OleDbDataReader dr = OracleCommand1.ExecuteReader(); while (dr.Read()); { me.cmbBox.Items.Add(dr[0].ToString()); } dr.Close();
Cheers,
Chris.
"Mike D" <Mi***@discussions.microsoft.com> wrote in message news:0C**********************************@microsof t.com... I am trying to add results of a query to a listbox. I have it working when the query returns one record but I need more. I am used to working with recordsets but I'm lost here in .net.
This is what I have but the query will return 2 SerialNumbers
Dim str As String
Me.OracleCommand1.CommandText = "SELECT SerialNumber FROM TAB_TEST WHERE (ACTIVE = 'Y')"
Dim RS As Data.DataColumnCollection str = OracleCommand1.ExecuteScalar Me.cmbBox.Items.Add(str) This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Giulio |
last post by:
Hello,
I have a continuous form with a combo box inside. From the combo box I can
pick some values which, by the "after-update" event, change some other combo
box values determined by a query....
|
by: Sami |
last post by:
Maybe I am going about this totally wrong....
What I have written is a query pulling SSN, Student-ID, LastName,
FirstName, MiddleInitital from a table.
Sort is so LastName, FirstName,...
|
by: Dave Hopper |
last post by:
Hi
I posted a question recently regarding problems I am having getting a
value from a list box to use in a query. I got a lot of help, for
which I thank you and it's nearly working! But I need...
|
by: Alan Lane |
last post by:
Hello world:
I'm including both code and examples of query output. I appologize if
that makes this message longer than it should be.
Anyway, I need to change the query below into a pivot table...
|
by: carl.barrett |
last post by:
Hi,
I have a list box that displays 2 columns. Behind it sits a query with
five columns. These are Column1 (DOB), column2 (a concatenated string
of Surname Forname, Title), Column3 (Surname),...
|
by: Jim Andersen |
last post by:
I have a problem with this standard employee-supervisor scenario
For pictures:
http://www.databasedev.co.uk/self-join_query.html
I want to show all employees "belonging" to a specific...
|
by: Chucara |
last post by:
Hi,
I'm trying to build a simple search in Access. I'll just give a simplified example, as I think I can solve the problem, if you can help me with this subproblem..
I have 2 listboxes -...
|
by: dachrist28 |
last post by:
I am trying to populate a listbox with data that is pulled from a sql
query. Here is my C# code behind the page:
sqlConn1.Open();
SqlCommand sqlComm2 = new SqlCommand("SElECT...
|
by: deejayquai |
last post by:
Hello
Simple one this I guess, but I'm quite stuck at the moment.
I would like to update the records displayed in my listbox
(lstStudents) using criteria selected from my combo (cboForm) in a...
|
by: exipnakias |
last post by:
Hello Guys. In a form I created a listbox which looks up the values of a table.
I want:
1)
..to create a query where a parameter will be needed in order to be loaded.
But I do not want to...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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,...
|
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,...
|
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: 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...
|
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...
| |