Visual Basic .NET Forums  

Go Back   Visual Basic .NET Forums > VB.NET > Winforms Data Access

Winforms Data Access VB.NET development for data access and back-end related areas

VB.NET Forums Newsletter Signup:
Email address:


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-02-2009, 11:47 AM
VB.NET Forum Newbie
.NET Framework: .NET 3.5 (VS 2008)
 
Join Date: Jan 2009
Age: 18
Posts: 1
Reputation: 0
aarond1990 is on a distinguished programming path ahead
Default RE: Adding Data Row, where one parameter refrences a parent table.

Hi there,
I hope this is in the correct place, as I'm new here!

Okay, so the problem i'm having is as follows.

I have a database (MS Access 2008) and a windows forms applicaltion (VB.NET 2008 SP3.5)

Two of the tables are 'Vehicle' and '2Owner'. The relationship is one-many, where one owner can appear in many vehicles - showing which department owns the vehicle.

Heres the problem:
I've got all the validation and presence checks in place etc, and have got to the add new row command, but the final parameter is asking for
Quote:
parentOwnerRowByOwnerVehicle As Vehicle_Management.VehicleManagement_DataSet.Owner Row
I know this should be a simple answer so I hope I've explaied it well enough.
For completeness I've added the surrounding code block.
Many thanks.
Aaron

Code:
Try
                            selectedOwner = 1
                            For i = 0 To OwnerDataGridView.RowCount() - 2
                                If StrComp(OwnerDataGridView.Rows(i).Cells(1).Value, boxOwner.SelectedItem.ToString) = 0 Then
                                    selectedOwner = OwnerDataGridView.Rows(i)
                                End If
                            Next
                            Vehicle_ManagementDataSet.Vehicle.AddVehicleRow(txtRegistration.Text, txtMilesService.Text, DateService.Text, DateTax.Text, DateMOT.Text, txtMake.Text, txtModel.Text, "Owner-ROW-HERE")
                            Me.Validate()
                            Me.VehicleBindingSource.EndEdit()
                            Me.TableAdapterManager.UpdateAll(Me.Vehicle_ManagementDataSet)


                        Catch ex As Exception
                            MsgBox("There has been an error adding this to the database " & _
                                    ex.ToString, MsgBoxStyle.Information, "Error adding to the database")
                        Finally
                            frmVehicle.cboRegistration.Items.Clear()
                            For i = 0 To VehicleDataGridView.RowCount() - 2
                                frmVehicle.cboRegistration.Items.Add(frmVehicle.VehicleDataGridView.Rows(i).Cells(0).Value)
                            Next
                            Me.Close()
                        End Try
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 01-02-2009, 6:13 PM
JohnH's Avatar
VB.NET Forum Moderator
.NET Framework: .NET 3.5 (VS 2008)
 
Join Date: Dec 2005
Location: Norway
Age: 36
Posts: 9,163
Reputation: 1079
JohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond repute
Default

I did this in similar case yesterday, hope you see the relation:
Code:
Dim arow As DBDataSet.ArtistRow = CType(CType(Me.ArtistBindingSource.Current, DataRowView).Row, DBDataSet.ArtistRow)
Me.DBDataSet.CD.AddCDRow(album, ur, arow, CShort(Date.Now.Year))
__________________
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Bookmarks

Tags
add row, addrow(), database, datagridview, parent row


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On





All times are GMT -4. The time now is 9:15 PM.

Powered by vBulletin® Version 3.8.3
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.0


For advertising opportunities click here.