![]() |
Click here to advertise with us
|
|
|||||||
| Database General Discussion General discussion on database related topics |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
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:
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
|
|
||||
|
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))
__________________
Some useful links: Learning videoes, Code Samples, WMI Code Creator, MSDN, The Code Project, WindowsClient.net, ASP.net, W3 Schools, Regular-Expressions.info, GDI+ FAQ
How to format posts with code blocks etc - present the problem/post properly ![]() |
![]() |
| 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 | |
|
|