PC Review


Reply
Thread Tools Rate Thread

combo box (display member) error

 
 
Harshil
Guest
Posts: n/a
 
      3rd Sep 2003
I am developing an application in vb.net and oracle as my database. my
goal is to display the county names (display member) to the user while
store county id (value member) in the combo box. when I run my code I
get county id displayed in the combo box rather than the county names.

When I tried debugging my code I found out the display member and the
value member get assigned the same value i.e ID.

What could possibly be wrong??


code
====================================


Dim Connect As OleDbConnection
Dim DA_County As OleDbDataAdapter
Dim DS_County As New DataSet()
Dim DT_County As New DataTable()
Dim gConnectString as string

gConnectString = "Provider=MSDAORA;" & _
"Data Source=dd;" & _
"User ID=dd; " & _
"Password=dd; "

Connect = New OleDbConnection(gConnectString)
Connect.Open()

DA_County = New OleDbDataAdapter("Select CountyName Name, CountyNo ID
from ipt.tblcounty order by CountyName", Connect)
DA_County.Fill(DS_County)
DT_County = DS_County.Tables(0)

cboCty.ValueMember = "ID"
cboCty.DataSource = DT_County
cboCty.DisplayMember = "Name"

Connect.Close()
Connect = Nothing
 
Reply With Quote
 
 
 
 
Patrick Steele [MVP]
Guest
Posts: n/a
 
      3rd Sep 2003
In article <(E-Mail Removed)>,
(E-Mail Removed) says...
> I am developing an application in vb.net and oracle as my database. my
> goal is to display the county names (display member) to the user while
> store county id (value member) in the combo box. when I run my code I
> get county id displayed in the combo box rather than the county names.
>
> When I tried debugging my code I found out the display member and the
> value member get assigned the same value i.e ID.
>
> What could possibly be wrong??
>
>
> code
> ====================================
>
>
> Dim Connect As OleDbConnection
> Dim DA_County As OleDbDataAdapter
> Dim DS_County As New DataSet()
> Dim DT_County As New DataTable()
> Dim gConnectString as string
>
> gConnectString = "Provider=MSDAORA;" & _
> "Data Source=dd;" & _
> "User ID=dd; " & _
> "Password=dd; "
>
> Connect = New OleDbConnection(gConnectString)
> Connect.Open()
>
> DA_County = New OleDbDataAdapter("Select CountyName Name, CountyNo ID
> from ipt.tblcounty order by CountyName", Connect)
> DA_County.Fill(DS_County)
> DT_County = DS_County.Tables(0)
>
> cboCty.ValueMember = "ID"
> cboCty.DataSource = DT_County
> cboCty.DisplayMember = "Name"


1. Try setting DisplayMember before setting the datasource.

2. Are you positive that "Name" is the proper column name?

--
Patrick Steele
Microsoft .NET MVP
http://weblogs.asp.net/psteele
 
Reply With Quote
 
Harshil Patel
Guest
Posts: n/a
 
      3rd Sep 2003

Hi!
I did try both of your suggestions. None of them work. My code will work
fine for a SQL Server database but somehow it wouldn't work for Oracle





*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
 
Reply With Quote
 
One Handed Man
Guest
Posts: n/a
 
      3rd Sep 2003
I assume that the underlying table has the data incorrectly filled as
displayed ? or is the problem somewhere in the binding ?

--
Regards - One Handed Man

Author : Fish .NET & Keep .NET
=========================================
This posting is provided "AS IS" with no warranties,
and confers no rights.


"Harshil Patel" <(E-Mail Removed)> wrote in message
news:%231Ik$(E-Mail Removed)...
>
> Hi!
> I did try both of your suggestions. None of them work. My code will work
> fine for a SQL Server database but somehow it wouldn't work for Oracle
>
>
>
>
>
> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!



 
Reply With Quote
 
Patrick Steele [MVP]
Guest
Posts: n/a
 
      3rd Sep 2003
In article <#1Ik$(E-Mail Removed)>,
(E-Mail Removed) says...
>
> Hi!
> I did try both of your suggestions. None of them work. My code will work
> fine for a SQL Server database but somehow it wouldn't work for Oracle


Perhaps "Name" is some kind of reserved word in Oracle? Just for kicks,
try "[Name]".

--
Patrick Steele
Microsoft .NET MVP
http://weblogs.asp.net/psteele
 
Reply With Quote
 
Harshil Patel
Guest
Posts: n/a
 
      3rd Sep 2003
the table is correctly filled with data. seems to me it is some kind of
binding problem.


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
 
Reply With Quote
 
Harshil Patel
Guest
Posts: n/a
 
      4th Sep 2003
I did try that but it still won't work. any other suggestions would be
appreciated

Thanks


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with Display/Value member of combo box Paolo Microsoft C# .NET 2 31st Oct 2008 08:00 AM
Compile error on Combo box: Method or data member not found =?Utf-8?B?UGV0ZXIgU3RvbmU=?= Microsoft Access Form Coding 2 31st Jul 2006 02:00 AM
Could not bind to the new display member error Dica Microsoft C# .NET 2 25th Oct 2005 08:52 PM
Combo Box Display Member is reset =?Utf-8?B?U2FuY2VycmU=?= Microsoft Dot NET Framework Forms 0 24th Sep 2004 04:13 PM
Concatenate Display Member in Bound Combo Aaron Ackerman Microsoft Dot NET 2 16th Oct 2003 02:03 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:44 PM.