Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

need help with visual studio 2005

Posted on 2006-11-29
17
Medium Priority
?
297 Views
Last Modified: 2013-12-04
ive had some minor background work with visual basic but not enough to tackle a program ive been asked to create, so i jumped from vb6 to visual studio since it appeared to be a more user friendly  environment with more of the drag and drop instead of coding
i have multiple tables in a database (PRC) that reference each other (ditem, item, supplier, polot, podata) and i have added the references and text boxes/data grids to the form, which i will show here:
http://www.mustangmods.com/ims/u/413/477/122599.jpg
the problem is when i click the first order in the orno table the lot # does not populate or refresh, it sticks with the amount of lots for the first order. by that i mean in the second datagrid there should now be 3 lots (1,2,3) instead of just 1, that is for the first orno. how can i go about doing this? please keep in mind im new to this? also, i used a datagrid because i want to show as many records as there are to display, so if it would work better to have 5,6,7,8...etc textboxes and a query for each to move to the next record i would do that if i knew how, or if that would work?

thanks in advance for any input
0
Comment
Question by:psuscott0483
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 9
  • 8
17 Comments
 
LVL 2

Expert Comment

by:LanBuddha
ID: 18041212

Go to Data -> Add new datasource

After you walk through the wizard you will have your dataset on the left. Right click on it and say edit dataset in designer.

Right click on lot table at top and add relationship.

add the relationship table and field from first table on left and related field on right.

Now in dataset drop first table on form.

Expand first table in dataset and you will see your second datatable

Drop it on form.

Run the program and things should work.
0
 

Author Comment

by:psuscott0483
ID: 18046519
ok, i was creating new datagrids instead of dropping over the one from the dataset on the side. thanks for your help!! the only problem im having now is updates dont save to any table except the first one (ditem)
0
 
LVL 2

Accepted Solution

by:
LanBuddha earned 2000 total points
ID: 18046743
The only way I have been successful on getting settings to save is to do it manually.

me.tableadapter.update(me.dataset.table)

Call the update method on the table adapter passing it the table to update.
0
Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

 

Author Comment

by:psuscott0483
ID: 18046901
0
 
LVL 2

Expert Comment

by:LanBuddha
ID: 18046973
When you created your dataset there is an advanced button where you place check marks in boxes that say something along the lines of create update and delete methods. I believe you can just right click on the table adapter and choose configure and add the check marks.
0
 

Author Comment

by:psuscott0483
ID: 18047006
http://www.mustangmods.com/ims/u/413/477/123399.jpg
in that area?

if i click foreign key constraint and relation (or just foreign key constraint) i can change those rules to setnull, setdefault, or cascade
0
 
LVL 2

Expert Comment

by:LanBuddha
ID: 18047053
In table design the table is on the top and the table adapter is on the bottom. Click the header of the table adapter and select configure. You will be at query design. There is an advanced button where you can create the rest of the functions. Sorry for being vague but I don't have access to VS right now.
0
 

Author Comment

by:psuscott0483
ID: 18047120
ok, this guy... http://www.mustangmods.com/ims/u/413/477/123632.jpg
i went to it on each table and theyre already checked off...but they dont want to update anything except the primary table ditem. i tried checking off the last one too which is only checked on 4 out of 6 of the tables
0
 

Author Comment

by:psuscott0483
ID: 18047130
no problem about being vague i really appreciate the input you are giving me
0
 
LVL 2

Expert Comment

by:LanBuddha
ID: 18047215
0
 
LVL 2

Expert Comment

by:LanBuddha
ID: 18047281
In your relation you have more than one key field. Do you have two values making up your primary key? If not remove the extra value in the relationship.

Also look at the bottom of this:

http://support.microsoft.com/default.aspx/kb/310376

0
 

Author Comment

by:psuscott0483
ID: 18047944
yes there is 4 primary keys in ditem, 1 in item, 1 in product, 2 in podata, 3 in polot, and 1 in supplier

i did not create these or setup the databases, should i remove the primary key from all but 1 field for each?
0
 

Author Comment

by:psuscott0483
ID: 18048020
on the database side the tables do not appear to have primary keys, i think that might be a problem, right?
0
 
LVL 2

Expert Comment

by:LanBuddha
ID: 18048288
It might have some problem. There usually needs to be some unique key in order for the code to know what record is being updated. I can't be sure.

If two keys make up the primary key then you don't need to remove from relationship. I'm was just looking for anything that may be causing your problems.
0
 

Author Comment

by:psuscott0483
ID: 18048304
ok i will work on getting primary keys in the database on the sql server side and see if that helps
0
 

Author Comment

by:psuscott0483
ID: 18053591
there are multiple primary keys in each table because say for table podata there is many order numbers (orno) with different position numbers (pono) but they are both set to primary keys, is that screwing me up? i can talk to the guy who setup the databases but i need to understand what im explaining to him first
0
 
LVL 2

Expert Comment

by:LanBuddha
ID: 18057058
I really can't be sure. VS makes an update function for you when you check that box. You would have to look at the code of the update function and check if it is symantically correct. I haven't had experience with this because the databases I have worked with did not have multiple fields that made up the key.

I think I would try and make a very simple test program first where I was only working and trying to update the table you are having problems with just to isolate the cause of the error.

Sorry for the delay getting back to you. I'm a little under the weather today.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A short article about problems I had with the new location API and permissions in Marshmallow
Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
Simple Linear Regression
Introduction to Processes

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question