Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

ComboBox
I'm having some trouble trying to figure out how to accomplish a task.
Right now I have a combobox that a user
can choose a name out of (the name consists of variables First_Name +
Last_Name).  Now after the user has made
their selection and clicks accept.  I'd like to somehow reference the
primary key in my database for the person with
that First and Last name.

Here is an example of my code -

private void SelectDriver_Load(object sender, EventArgs e)
{
DriverDatabase ObjDDB = new DriverDatabase();


foreach (DataRow myRow in ObjDDB.tableDrivers.Rows)

{

string First_Name = myRow["First_Name"].ToString();

string Last_Name = myRow["Last_Name"].ToString();

this.driverbox.Items.Add(First_Name + Last_Name);

}

ObjDDB = null;

}



That code populates my ComboBox with the information from my database.  Now,
when the user clicks on my 'Accept' button

I'd like to be able to reference the record in the database for which he/she
has selected.  I could do a query in the database for

the first and last name, according to the output of combobox.text when the
user hits enter but that wouldn't work because first

and last name are not unique.  It might find more then one record or even
the wrong record.



I'm fairly new to programming, so any help would be appreciated.



Thanks



- Rob













Report this thread to moderator Post Follow-up to this message
Old Post
RobRich
11-16-04 11:54 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

C# archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 06:05 AM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.