2 database relations with a parent and two...

blueeyes53

Active member
Joined
May 2, 2006
Messages
25
Programming Experience
Beginner
Hey there,

I have 3 tables:

tlbFactory(Master)
tblCustomer(detail)
tblSupplier(detail)

2 datarelation =
1) drtblFactorytblCustomer
2) drtblFactorySupplier

2 datagrids (1) for each details table, of which one datagrid should only one be visible at a time.

tblFactory(Master) has 3 txtboxes:
1) for FactoryID
2)for FactoryName
3) for FactoryAddress

with Menu items to navigate between:
First, next, previous, last, etc.

Everytime I used the odbdaCustomer,and/ or any other of the data adapters which I have 3 ,one for each table I get an error message and I can't see any of the tables information in any of the datagrids. Could anyone tell me what is the code that I need to use to be able to see the tables information, and why do you think that is giving me the error message that something related to the contstraint key.:confused:
 
Perhaps you could tell us what it is you're doing at the moment and be a bit more precise with the error message. If we're to diagnose a problem we need information. Otherwise it's pure guesswork and a waste of everyone's time.
 
If the computer gave you a specific error message, it should be trivial matter to copy it and paste it here. Constraint exceptions probably occur in this case because:

You are trying to add a detail record for which there is no master record present (cannot add customer with factoryID 123 if factoryID 123 does not exist)
You are trying to insert a null value into one of the columns you have confiugured to be a primary key
You are trying to insert a value that alrteady exists, into a key column or a set of values into a group of key columns, where all those values already exist in that particular combination
 
2 database relations with a parent and 2 detail tables

Hey there,

This is the error message that I am receiving:
VB.NET:
An unhandled exception of type 'System.ArgumentOutofRange Exception' occurred in mscorlib.dll
 
Additional Information: Index was out of range. Must be non- negative and less than the size of the collection.
[CODE]

How that someone could help with these whole project issue.
Thanks:confused:
 
I think that error message speaks for itself. You've used an index that is outside the bounds of your collection. Note that arrays and collections are zero-based. That means that if you're going to use a loop to visit every item you have to go from zero to one less than the number of items, e.g.
VB.NET:
For i As Integer = 0 To myCollection.[U]Count - 1[/U] Step 1
Again, I'm guessing that this is what's causing the issue because you haven't shown us what you're doing. If something goes wrong then it's helpful to know what was happening at the time, which means that you need to show us the code for the section in which the exception is thrown.

Here's how a post should go:

I'm trying to do this.
Here's what happens when I try.
This is the code I am using.
Here's the error message I got and where it occurred.

Be clear. Don't make us guess. Would you expect a doctor to diagnose your illness without any information about your symptoms? Would you expect a mechanic to fix your car without looking under the hood? Not all the steps above will be applicable in all cases but when your code is throwing an exception then they definitely are.
 
Thank you for your quick reply...

Again, Thanks for your help, and I will post again about this issue following your points.:confused:
 
that is giving me the error message that something related to the contstraint key.:confused:

Hey there,

This is the error message that I am receiving:
VB.NET:
An unhandled exception of type 'System.ArgumentOutofRange Exception' occurred in mscorlib.dll
[/quote]
 
An error message about a constraint and an error message about a range are very different. Are you receiving two error messages?
 
Back
Top