Finally Crossing Over

I got tired of everyone telling me I was not a real programmer becasue I only used ms access for my projects, so I have undertaken the huge task of learning c#. I have read about 3 books, and am now working on my forth book, "Programming forms with c#".  
Either way, My question is,
I have 2 tables,
Table 1 is of vendors
Table 2 is of vendor products

Table 1 has a foreign key to table 2. When I load up table 1 in the grid, it is showing the actual key. I need it to show the name of the product instead of the key, and allow the user to select a product from a combo box.
Who is Participating?
bdsmithbackConnect With a Mentor Commented:
You can do a general try - catch block and catch all exceptions.  IE:

    .... code for database access
catch(Exception ex)

This will catch any exception in the try block and display the error in a Message Box.
ppearson3000Author Commented:
I forgot to mention, that the relationship is set up properly in the sql server. When it imports from the db, it shows the relationship but odly enough it shows the products table with the vendor table as a sub table in the server listing.
Bob LearnedCommented:
1) Access provides some nice functionality so that you don't need to know how things work, they just do

2) With C# you need to understand more about the underlying nature of things

3) You haven't give us enough information to understand what you mean.

4) .NET version?  2002, 2003 or 2005?

5) What server listing?  Server Explorer?

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

ppearson3000Author Commented:
yes.. I am working with .net 2005. It cost me like 500 bucks. and I am talking about server explorer.
I miss access by the way. This was never a problem. I actually did not have to make a database diagram when I used access, I could just link them up in the queries. But apparently I have to have a database diagram with a dfd (which I know how to make, but am just lazy). Either way, I am still trying to get those products to show in the drop down, instead of the product numbers, and then have them save back into the db as the product numbers.
>>I got tired of everyone telling me I was not a real programmer becasue I only used ms access for my projects
Are you sure C# is what they were referring to and not a database?

In either case along with learning C# you should consider learning a real database like SQL server.
In C#, when you do a query on a table like select * from tablename1, it will return all of the information from that table only.  It sounds like you need to do a join to get the information you desire.  Select * from tablename1 join tablename2 on tablename1.foreignkey = tablename2.primarykey.  If you haven't looked into yet, that's a great place to start:
ppearson3000Author Commented:
I have an interesting situation in that I have done some pretty advanced stuff with ms access. I worked mostly with sql server 2000 and access data projects. Most of my form changes involved changing the recordsource of a form to a sql statement based on some user input, and then requeryin the form. either way I am on book number 3 on c#, and I figured out how to get the lookup table to work properly. All I had to do was go into the column on the datagrid, and bind it to the product table directly. I made the value equal to the primary key, and I made the shown column be the name of the product.
the only remaining portion of this question that is unanswered is, now I am getting a data exception. I know that I need to put it in a try/catch construct, but I can't seem to find the code that I surround for the datagrid. Would it be in the initialize component()??
Thanks ppearson3000
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.