Hi,
Generaly to populate combobox , I use following command :-
Combobox1.datasource = dataset.tablename
combobox1.displaymember = fieldname1
combobox1.valuemember = fieldname2
As I don't want to generate dataset, and instead of it, want to use
datareader , can I give following command
Combobox1.datasource = DataReader
combobox1.displaymember = DataReader.FieldName1
combobox1.ValueMember = DataReader.FieldName2
I also don't want to do like following :-
Do While myReader.Read()
Combobox1.additem (myreader.item(...))
Loop
Is above is possible or is there any other way to populate combobox data ?
Any hints will be sincerely appreciated.
Hardik Shah 7 17363
Hardik,
It is possible, however probably with a lot more overhead than using a
dataset (datatable).
What is the reason you don't want that simple dataset/datatable?
Cor
Simple reason is that ,
As per my knowledge DataReader is faster than dataset and it doesn't occupy
space at client.
I give detail about my project :
In single data entry form there are 8 to 10 ComboBox with different table's
column , I have to create separate dataset for each table, data adapter,
schemas etc..
Am I right , or require to reunderstand the concept.
Please help me to clear above concept.
Hardik Shah.
"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message
news:ey*************@tk2msftngp13.phx.gbl... Hardik,
It is possible, however probably with a lot more overhead than using a dataset (datatable).
What is the reason you don't want that simple dataset/datatable?
Cor
Hardik,
How many datatables from your database server are you using?
Cor
"Hardik Shah" <ha********@hotmail.com> schreef in bericht
news:OM**************@TK2MSFTNGP12.phx.gbl... Simple reason is that , As per my knowledge DataReader is faster than dataset and it doesn't occupy space at client. I give detail about my project : In single data entry form there are 8 to 10 ComboBox with different table's column , I have to create separate dataset for each table, data adapter, schemas etc..
Am I right , or require to reunderstand the concept.
Please help me to clear above concept.
Hardik Shah.
"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message news:ey*************@tk2msftngp13.phx.gbl... Hardik,
It is possible, however probably with a lot more overhead than using a dataset (datatable).
What is the reason you don't want that simple dataset/datatable?
Cor
Hi,
1 or 2 databases
Hardik
"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message
news:uk*************@TK2MSFTNGP09.phx.gbl... Hardik,
How many datatables from your database server are you using?
Cor
"Hardik Shah" <ha********@hotmail.com> schreef in bericht news:OM**************@TK2MSFTNGP12.phx.gbl... Simple reason is that , As per my knowledge DataReader is faster than dataset and it doesn't occupy space at client. I give detail about my project : In single data entry form there are 8 to 10 ComboBox with different table's column , I have to create separate dataset for each table, data adapter, schemas etc..
Am I right , or require to reunderstand the concept.
Please help me to clear above concept.
Hardik Shah.
"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message news:ey*************@tk2msftngp13.phx.gbl... Hardik,
It is possible, however probably with a lot more overhead than using a dataset (datatable).
What is the reason you don't want that simple dataset/datatable?
Cor
Hardik,
I asked tables not databases, however assuming you mean tables in a database
than can it be something as roughly typed here as a kind of pseudo
dim ds as new dataset
dim conn as new sqlconnection(connectionstring)
dim da new dataapter(sqlstring1,conn)
da.fill(ds)
da.selectcommand.commandtext = sqlstring2
da.fill(ds)
dim dv1 as dataview(ds.tables(0)
dim dv2 etc
dim dvt as dataview(ds.tables(1)
combobox1.datasource = dv1
combobox1.displaymember = "whatever"
combobox2.displaymember = "whatelse"
etc etc.
I hope this gives an idea.
Cor
"Hardik Shah" <ha********@hotmail.com> schreef in bericht
news:OZ**************@TK2MSFTNGP14.phx.gbl... Hi,
1 or 2 databases
Hardik
"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message news:uk*************@TK2MSFTNGP09.phx.gbl... Hardik,
How many datatables from your database server are you using?
Cor
"Hardik Shah" <ha********@hotmail.com> schreef in bericht news:OM**************@TK2MSFTNGP12.phx.gbl... > Simple reason is that , > As per my knowledge DataReader is faster than dataset and it doesn't > occupy > space at client. > I give detail about my project : > In single data entry form there are 8 to 10 ComboBox with different > table's > column , I have to create separate dataset for each table, data > adapter, > schemas etc.. > > Am I right , or require to reunderstand the concept. > > Please help me to clear above concept. > > Hardik Shah. > > > "Cor Ligthert [MVP]" <no************@planet.nl> wrote in message > news:ey*************@tk2msftngp13.phx.gbl... >> Hardik, >> >> It is possible, however probably with a lot more overhead than using a >> dataset (datatable). >> >> What is the reason you don't want that simple dataset/datatable? >> >> Cor >> >> > >
On 2005-09-16, Hardik Shah <ha********@hotmail.com> wrote: Hi,
Generaly to populate combobox , I use following command :- Combobox1.datasource = dataset.tablename combobox1.displaymember = fieldname1 combobox1.valuemember = fieldname2
As I don't want to generate dataset, and instead of it, want to use datareader , can I give following command Combobox1.datasource = DataReader combobox1.displaymember = DataReader.FieldName1 combobox1.ValueMember = DataReader.FieldName2
I also don't want to do like following :- Do While myReader.Read()
Combobox1.additem (myreader.item(...))
Loop
Is above is possible or is there any other way to populate combobox data ?
Could be I missed a post where somebody said this, but the answer is no.
You can't databind a datareader to a ComboBox. If you want a reader as
the data source, you'll need to loop through the data items. Although
it's pretty trivial to write a function that does this for you.
David, Is above is possible or is there any other way to populate combobox data ?
Could be I missed a post where somebody said this, but the answer is no. You can't databind a datareader to a ComboBox. If you want a reader as the data source, you'll need to loop through the data items. Although it's pretty trivial to write a function that does this for you.
Probably you did not think about that and know it, at least do you have to
write an Ilist implementing solution to use the valuemember as the OP is
asking. For me always a kind of masochism if you know that it can be done
with the datatable in some lines of code.
:-)
Cor This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Brian Takita |
last post by:
Hello,
I am trying to Implement a DataSource property for a custom control
using a ListView.
This DataSource should be like all other DataSource properties for data
bound controls in .NET. The...
|
by: praveen benna via DotNetMonster.com |
last post by:
hi,
I wanted to create windows custom control which contains a tree view and
grid.The tree view contains folder directory and grid reflects the contents
of selected folder.(similar to windows...
|
by: Fred Dag |
last post by:
Hi,
I am trying to get the DataSet from a Repeater using its DataSource property
from an event handler.
I am getting Null instead.
Should the DataSource persist when the event hadler is...
|
by: Charles Law |
last post by:
This is driving me mad. Can someone please put me out of my misery?
I have a DataSet which I wish to use as the data source for a grid control
(it is actually an Infragistics grid). When I assign...
|
by: lanmou |
last post by:
hi,
I have a listbox whose datasource property is set.i would like to
delete the item from the listbox after the records of that item are deleted from the database.the selecteditem.clear or refresh...
|
by: PJ6 |
last post by:
If I have a DataGridView in my form, when I click on the DataSource
property, I get a message box displaying the exception message, "Object
reference not set to instance of an object."
What's...
|
by: progressdll |
last post by:
I'm trying to change the behaviour of setting the DataSource property
of combobox.
Here is the behaviour I now see.
Setting the DataSource property of combobox to an ArrayList will visual...
|
by: Ken Varn |
last post by:
I have just started using VS.NET 2005 after using VS.NET 2003. One of the
things that I noticed is that in ASP.NET, the DataSource property for
TextBoxes and other web controls is no longer...
|
by: mironline |
last post by:
Dear friends
I have a problem with overriding the DataSource Property of DataGridView.
I wonder if anyone can help me to find good solution for this issue .
public class myGrid :...
|
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
|
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...
|
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: 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...
|
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: 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...
|
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,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |