Yes - I had looked at the example before this post. Unfortunately, I don't get an option of just update. UpdateAll, UpdateOrder and UpdateOrderOption are the only choices. None of which I want.
Thanks.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Have a VB form in which there is a main SQL table with 3 other SQL tables linked to get various data. Can't update main table, throws exceptions for the other 3 linked tables. Believe form is trying to update the linked tables as well.
Is there a way to update the main SQL table, without updating the other 3 linked tables?
Thanks in advance for any help
Yes - I had looked at the example before this post. Unfortunately, I don't get an option of just update. UpdateAll, UpdateOrder and UpdateOrderOption are the only choices. None of which I want.
Thanks.
Since you're using TableAdapterManager
then that tells me your project is using a typed dataset. That means all the code for that type is in your project. You can right click the type and jump to the code to look at it. Under the hood it is going to use a DataAdapter
to do the actual saving.
To update a single table use the Update
method and pass the table name. Although it shouldn't matter because the adapter is only going to save changes that were actually made.
Me.TableAdapterManager.Update(Me.ThermodbDataSet.TableIWantToUpdate)
The error message indicates that not all the table adapters have been configured. Normally the TAM is just a series of TableAdapters. Each TA, which is also custom generated and in your project, maps to a single table and knows how to save a specific table entry. When the TAM is associated with a connection it should apply the connection to each child TA as well. It's possible your error will go away when you change the above code to save just the table you care about. If not then we can investigate further.
Refer to this example as an example of what that code looks like.
Code to get data -->
SELECT condsingle.product_no, condsingle.spec_id, condsingle.issued_date, condsingle.spec_revision_level, condsingle.cable_description, condsingle.insulation_color, condsingle.extruder_die_size, condsingle.tip_size,
condsingle.nominal, condsingle.target, condsingle.minimum, condsingle.max_runout, condsingle.average_minimum_wall, condsingle.minimum_point_wall, condsingle.min_lb, condsingle.max_lb, condsingle.sparker_voltage,
condsingle.process_oil, condsingle.serve, condsingle.conductor_wt_mft, condsingle.insulator_wt_mft, condsingle.print, condsingle.notes, condsingle.note_2, condsingle.note_3, condsingle.note_4, condsingle.note_5,
condsingle.note_6, condsingle.note_7, condsingle.note_8, condsingle.note_9, condsingle.note_10, condsingle.ul, condsingle.csa, condsingle.sae, condsingle.chrysler, condsingle.ford, condsingle.packard, condsingle.other,
condsingle.prod_type, cond_approve.user_name AS ApproveUserName, cond_verify.user_name AS VerifyUserName, cond_ccode.specification AS CcodeSpecification, cond_ccode.die_size AS CcodeDieSize,
cond_compound.description AS CompDesc, cond_compound.obsolete AS CompObsol, condsingle.verified_by AS CondSingleVer, condsingle.approved_by AS CondSingleAppr,
condsingle.compound_code AS CondSingleCompCod, condsingle.conduct_code AS CondSingleCondCod
FROM condsingle INNER JOIN
cond_approve ON condsingle.approved_by = cond_approve.approve_by INNER JOIN
cond_verify ON condsingle.verified_by = cond_verify.verify_by INNER JOIN
cond_ccode ON condsingle.conduct_code = cond_ccode.conduct_code INNER JOIN
cond_compound ON condsingle.compound_code = cond_compound.cp_no
ORDER BY condsingle.spec_id
Where exception occurs -->
Private Sub CondsingleBindingNavigatorSaveItem_Click(sender As Object, e As EventArgs) Handles CondsingleBindingNavigatorSaveItem.Click
Dim ProContinue As String = "Y"
ChkData(ProContinue)
If ProContinue = "Y" Then
Me.Validate()
Me.CondsingleBindingSource.EndEdit()
Me.TableAdapterManager.UpdateAll(Me.ThermodbDataSet)
End If
End Sub
Thinking I need a different approach to how the tables are linked together.
Thanks
So you're using ADO.NET's Dataset to load the data. What exact error are you getting when you try to call UpdateAll?
Assuming that you aren't violating a DB constraint (such as associating a bad approve_by
value then the adapter should be able to save the data properly. Can you post the UpdateCommand
that you set on your data adapter?
First - I don't want to UpdateAll - I only want to update Condsingle data table. The other tables are used for displaying information as the user goes thru the data, info changes accordingly.
Error message - TableAdapterManager contains no connection information. Set each TableAdapterManager TableAdapter property to a valid TableAdapter instance.
Can you post the UpdateCommand that you set on your data adapter? --- Not sure where to get this from? Which could be an issue.
Thanks
@Michael Taylor