473,320 Members | 2,024 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

displaying child table in datagrid

hi!

ok, im working on a database application. ive successfully managed to
establish a relationship between two tables and display them on a datagrid,
edit and add new records to them.

now i need to generate a report using the parameters in the child table, and
two columns from the parent table. this is where the problem starts. when i
use two seperate connection links and extract the required data, adding it
all to the same dataset, the information appears as if there's a blank parent
table, with two child tables. i cant get the datagrid to just treat the
dataset as one set of information and display that. (tried even the dataset.
relations.clear() without any luck)

this is the code i used:

'opening connection link to amc1 and filling only required parts of table.
link2.ConnectionString = "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data
Source = C:\amc.mdb"
link2.Open()

'emptying dataset incase form reloads
Try
ds2.Clear()

sql2 = "SELECT * FROM amc2"
da2 = New OleDb.OleDbDataAdapter(sql2, link2)
da2.Fill(ds2, "amc2")

link3.ConnectionString = "PROVIDER = Microsoft.Jet.OLEDB.4.0;Data
Source = C:\amc.mdb"
link3.Open()

sql3 = "select cus1 From amc1"
da3 = New OleDb.OleDbDataAdapter(sql3, link3)
da3.Fill(ds2, "amc1")

ds2.Relations.Clear()

dg1.DataSource = ds2
Catch ex As Exception
MsgBox("Error: " & ex.Source & ":" & ex.Message, MsgBoxStyle.
OKOnly)
End Try

End Sub

since that didnt work, ive tried copying out the information from the first
table to the child table and displaying all columns in the child table - i'd
prefer not to do this because for one thing my database will have at least
25000 rows, so it will really slow down things!

but even in this code, i get this error :
"Failed to enable constraints. One or more rows contain values violating non-
null, unique or foreign key constraints".
checked out the access table settings - there's no such violation. all the
cells have a value, i havent enabled any unique value constraint. (what's a
foreign key constraint?)

this is the code i used for this:

Private Sub appearance2()
'opening connection link to amc1 and filling only required parts of
table.
link2.ConnectionString = "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data
Source = C:\amc.mdb"
link2.Open()

'emptying dataset incase form reloads
Try
ds2.Clear()

sql2 = "SELECT * FROM amc2"
da2 = New OleDb.OleDbDataAdapter(sql2, link2)
da2.Fill(ds2, "amc2")

ds2.Relations.Clear()

dg1.DataSource = ds2
Catch ex As Exception
MsgBox("Error: " & ex.Source & ":" & ex.Message, MsgBoxStyle.
OKOnly)
End Try

End Sub

can someone please help me out? thanks a lot.

--
Message posted via DotNetMonster.com
http://www.dotnetmonster.com/Uwe/For...b-net/200601/1
Jan 16 '06 #1
0 1493

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: DelphiBlue | last post by:
I have a Nested Datagrid that is using a data relations to tie the parent child datagrids together. All is working well with the display but I am having some issues trying to sort the child...
3
by: Quetzal | last post by:
Hello, I have a dataset populated using an XML file. The schema has hierarchical components. Let's say <a><b></b></a>. I have created a datagrid and I have assigned a datastyle and then...
0
by: Ross | last post by:
ASP.NET Problem: I have a dataset with a parent table and a child table. For every row in the parent table there are ~1/2 dozen corresponding records in the child table. In the ASPX page I have a...
7
by: Neo Geshel | last post by:
Greetings. I have a serious problem. I have multiple sets of tables, several of which are chained more than two tables deep. That is, I have a parent, a child, and a great-grandchild table. ...
0
by: DraguVaso | last post by:
Hi, I have in my VB.NET-application a DataGrid with two DataTables in with a Parent-Child-relationship defined. When the users clicks on a call in the DataGrid, i want to know the MappingName...
1
by: pete matthews | last post by:
HI. I have a dataset with two tables. Table 1 is parent and table 2 is child. Am populating a single datagrid with records from child table derived from a single parent record. I am then allowing...
8
by: Richard L Rosenheim | last post by:
I have a dataset containing a parent table related to a child table. The child table contains an ID field (which is configured as autonumber in the datatable), the ID of the parent, plus some...
11
by: Kay | last post by:
Hi all, I have populated a dataset with several tables, say - Roster, Agent and few more . The dataset is used to populated a listview with some shift info.. I think I'm sucessfully created a...
0
by: Ambica Jain | last post by:
I have a data grid called Files, which has some columns like FileName, Col1, Col2, ... , Col8. Then i have a combobox which allows user to select from Col1 to Col8 and based on this selection, i...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.