Hi all,
I think I've stared at it until it's made me stupid(er?). What am I missing
about setting the list of the dropdown to display data pulled from a table?
//...
daPrepaid.Fill( dsPrepaid, "Seller");
cboSeller.DataS ource = dsPrepaid.Table s["Seller"];
cboSeller.Displ ayMember = "Name";
//...
When I assign the datasource, the dropdown's Text property changes to
"System.Data.Da taRowView", which is then the only item in the list as well.
What's the stupid thing I'm not seeing?
TIA,
John 20 9381
Aren't you missing the cboSeller.Value Member="Name"; <-- or whatever field ?
Greg
"John Spiegel" <js******@YETAN OTHERSPAMHATERc-comld.com> wrote in message
news:eL******** ******@TK2MSFTN GP10.phx.gbl... Hi all,
I think I've stared at it until it's made me stupid(er?). What am I missing about setting the list of the dropdown to display data pulled from a table?
//... daPrepaid.Fill( dsPrepaid, "Seller"); cboSeller.DataS ource = dsPrepaid.Table s["Seller"]; cboSeller.Displ ayMember = "Name"; //...
When I assign the datasource, the dropdown's Text property changes to "System.Data.Da taRowView", which is then the only item in the list as well. What's the stupid thing I'm not seeing?
TIA,
John
John,
A change is in my opinion that "Name" is in the wrong case or even not in
your select..
That because you use three words cbo (combobox) and DropDown.
When cbo is a webpage dropdownlist than it is easy.
You miss
cboSeller.DataB ind();
I hope this helps?
Cor
Hey Greg,
I had it in, but was getting an error. The strange thing is when I do
include ValueMember, the error message indicates a problem with binding to
DisplayMember, more specifically:
Could not bind to the new disply member.
Parameter name: newDisplayMembe r
A less abbreviated snippet...
OleDbCommand cmdPrepaid = conPrepaid.Crea teCommand();
cmdPrepaid.Comm andType = CommandType.Tex t;
cmdPrepaid.Comm andText = "SELECT * FROM PrepaidSeller";
daPrepaid = new OleDbDataAdapte r();
daPrepaid.Selec tCommand = cmdPrepaid;
dsPrepaid = new DataSet();
conPrepaid.Open ();
try
{
daPrepaid.Fill( dsPrepaid, "Seller");
cboSeller.DataS ource = dsPrepaid.Table s["Seller"];
cboSeller.Displ ayMember = "EntityName ";
cboSeller.Value Member = "CustKey";
//...
}
Thanks,
John
"Greg Burns" <greg_burns@DON T_SPAM_ME_hotma il.com> wrote in message
news:%2******** ********@TK2MSF TNGP15.phx.gbl. .. Aren't you missing the cboSeller.Value Member="Name"; <-- or whatever field
? Greg
"John Spiegel" <js******@YETAN OTHERSPAMHATERc-comld.com> wrote in message news:eL******** ******@TK2MSFTN GP10.phx.gbl... Hi all,
I think I've stared at it until it's made me stupid(er?). What am I missing about setting the list of the dropdown to display data pulled from a table?
//... daPrepaid.Fill( dsPrepaid, "Seller"); cboSeller.DataS ource = dsPrepaid.Table s["Seller"]; cboSeller.Displ ayMember = "Name"; //...
When I assign the datasource, the dropdown's Text property changes to "System.Data.Da taRowView", which is then the only item in the list as well. What's the stupid thing I'm not seeing?
TIA,
John
Hey Cor,
That's interesting. It was the case! I had used mixed case naming in
another piece a few days ago--but that was in a typed data set.
Thanks!
John
"Cor Ligthert" <no************ @planet.nl> wrote in message
news:%2******** ********@TK2MSF TNGP11.phx.gbl. .. John,
A change is in my opinion that "Name" is in the wrong case or even not in your select..
That because you use three words cbo (combobox) and DropDown.
When cbo is a webpage dropdownlist than it is easy. You miss cboSeller.DataB ind();
I hope this helps?
Cor
John,
Always the same problem and than I forgot it. You cannot use reserved SQL
words as items and AFAIK is "Name" one of them.
Cor
> A change is in my opinion that "Name" is in the wrong case or even not in your select..
Cor, I don't believe case-sensitivity matters. No?
If this were a web page, the dropdownlist binding would look something like
this:
ddlSeller.DataS ource = dsPrepaid.Table s["Seller"];
ddlSeller.DataT extField = "Name";
ddlSeller.DataV alueField = "NameID"; <-- change appropriately
ddlSeller.DataB ind()
' optional...
ddlSeller.Items .Insert(0, New ListItem("-select a Name-", ""))
If it is a combobox on winform, then:
cboSeller.DataS ource = dsPrepaid.Table s["Seller"];
cboSeller.Displ ayMember = "Name"
cboSeller.Value Member = "NameID"; <-- change appropriately
Personally, considering all the troubles I've had databinding with winforms
(selectedindex=-1 issues, bound controls on tabcontrols, etc.) I prefer to
just iterate the datatable and manually add the items. But that's just me.
my .02
Greg
Greg
"Cor Ligthert" <no************ @planet.nl> wrote in message
news:%2******** ********@TK2MSF TNGP11.phx.gbl. .. John,
A change is in my opinion that "Name" is in the wrong case or even not in your select..
That because you use three words cbo (combobox) and DropDown.
When cbo is a webpage dropdownlist than it is easy. You miss cboSeller.DataB ind();
I hope this helps?
Cor
Greg,
I saw that afterwards the same as you, that it could not be a webform
because that the dropdownlist has not a displaymember.
However than had John already sent a message replying you, I replied that
and after that he came with the answer that is was a case situation.
However I am still not sure if it was the case situation here or the wrong
itemname.
However the "case" is important in this situation (I have seen this to often
in this newsgroup while it is as well my own expirience). And the strange is
with that that SQL is case insensitive.
However just as far as I know.
Cor
Hmm.
I too was confused about winform and webform. :)
I thought you were onto something with the reserved word thing. And the strange is with that that SQL is case insensitive.
"In SQL Server, object names can be case-sensitive, depending on the
character sort order that is installed. The sort order is chosen in SQL
Server Setup during installation. The default sort order in SQL Server
is dictionary order, case-insensitive.
If you need to change sort orders after installation, you must rebuild
your databases and reload your data."
John, try typing "execute sp_helpsort "in Query Analyzer to see what the
sort order and case-sensitivity is of your server. I know I am curious. :)
Greg
"Cor Ligthert" <no************ @planet.nl> wrote in message
news:uD******** ******@TK2MSFTN GP12.phx.gbl... Greg,
I saw that afterwards the same as you, that it could not be a webform because that the dropdownlist has not a displaymember.
However than had John already sent a message replying you, I replied that and after that he came with the answer that is was a case situation.
However I am still not sure if it was the case situation here or the wrong itemname.
However the "case" is important in this situation (I have seen this to often in this newsgroup while it is as well my own expirience). And the strange is with that that SQL is case insensitive.
However just as far as I know.
Cor
Sorry, I had been silly in my editing. The actual field name was
"EntityName "--which is what I was using on the .NET side as well...
"Cor Ligthert" <no************ @planet.nl> wrote in message
news:uI******** ******@TK2MSFTN GP12.phx.gbl... John,
Always the same problem and than I forgot it. You cannot use reserved SQL words as items and AFAIK is "Name" one of them.
Cor
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Alvaro E. Gonzalez V. |
last post by:
Hello!!!
I'm building a control that in a property
assign a Dataset which they are initialized and another property Like
DataMember.
Similar as it happens to the DataSource property of a System.Windows.Forms.ListBox...
That mechanism can be used or as is the best way to do it...
|
by: Kris Rockwell |
last post by:
Hello,
I have done the following to bind data to a DropDown box:
1. Drag SQLServer table onto web form to create data connection and data
adapter.
2. Generate dataset by right-clicking on the data adapter ad selecting
generate dataset.
|
by: Pietje puk |
last post by:
Hello,
Since im quite new to ASP.NET i wanted to ask you folks what the best
way is to create a WebForm for modifying 1 field from a record. The
manipulation of this field can be done by using dropdown list.
Previously i've written a lot of these page's by not using the
webcontrols, but now i've reached this magically moment that i want...
|
by: John Spiegel |
last post by:
Hi all,
I think I've stared at it until it's made me stupid(er?). What am I missing
about setting the list of the dropdown to display data pulled from a table?
//...
daPrepaid.Fill(dsPrepaid, "Seller");
cboSeller.DataSource = dsPrepaid.Tables;
cboSeller.DisplayMember = "Name";
//...
|
by: Chris |
last post by:
Hi,
I have a button on a form, that opens a second form where I'm cloning
a usercontrol, something akin to Access' continuous forms. Now, in
this usercontrol I have a couple comboboxes. Now I need to run a
query to get the data I want to set as these comboboxes' datasource.
How can I set the datasource just ONCE, as opposed to each time...
| |
by: Wingot |
last post by:
Hey,
I have a program I am trying to write using Visual C#, SQL Server
2005/2008, and Visual Studio 2008, and one part of it includes a Schema
called Client. Inside this schema, three tables exist named Country,
MedicalCondition, and Customer.
|
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...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it. ...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
|
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...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes...
| |
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
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...
| |