Solved

need help with visual studio 2005

Posted on 2006-11-29
17
260 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
  • 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 500 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
 

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
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 

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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Suggested Solutions

Artificial Intelligence comes in many forms, and for game developers, Path-Finding is an important ability for making an NPC (Non-Playable Character) maneuver through terrain.  A* is a particularly easy way to approach it.  I’ll start with the algor…
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

706 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now