SQL Server Update Problem
-
I have a very weird problem. I'll try to be specific, but I'm just beginning VB.NET programming. I built a SQL Server 2005 database from the ground up. Currently I'm building a front-end in VB.NET. I'm using a Janus GridEX 2 to make a hierarchy of projects, assemblies, and parts. For some reason, the projects and assemblies update fine, but the parts and "Assemblies to Assemblies" (used to make nearly infinate levels of hierarchy) tables create an error saying it can't update the Id. The Id is required to make the program work, so I can't just remove it. The first two lines work. The last two do not.
Me.ProjectTableAdapter.Update(Me.ProjPurch2005DataSet.Project) Me.AssemblyTableAdapter.Update(Me.ProjPurch2005DataSet._Assembly) Me.Assy2AssyTableAdapter.Update(Me.ProjPurch2005DataSet.Assy2Assy) Me.PurchaseTableAdapter.Update(Me.ProjPurch2005DataSet.Purchase)
Is there a blatent reason that I'm just not seeing? :confused: -
I have a very weird problem. I'll try to be specific, but I'm just beginning VB.NET programming. I built a SQL Server 2005 database from the ground up. Currently I'm building a front-end in VB.NET. I'm using a Janus GridEX 2 to make a hierarchy of projects, assemblies, and parts. For some reason, the projects and assemblies update fine, but the parts and "Assemblies to Assemblies" (used to make nearly infinate levels of hierarchy) tables create an error saying it can't update the Id. The Id is required to make the program work, so I can't just remove it. The first two lines work. The last two do not.
Me.ProjectTableAdapter.Update(Me.ProjPurch2005DataSet.Project) Me.AssemblyTableAdapter.Update(Me.ProjPurch2005DataSet._Assembly) Me.Assy2AssyTableAdapter.Update(Me.ProjPurch2005DataSet.Assy2Assy) Me.PurchaseTableAdapter.Update(Me.ProjPurch2005DataSet.Purchase)
Is there a blatent reason that I'm just not seeing? :confused:`Drew wrote:
create an error saying it can't update the Id.
The Data and Table adapter require that the table's they are working on have primary keys. If your table doesn't have one, you can't do any updating of the tables until you put one in and update the DataAdpter or TableAdapter SQL statements to return that key field in the query results. ...or did I miss something in your post??
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007 -
`Drew wrote:
create an error saying it can't update the Id.
The Data and Table adapter require that the table's they are working on have primary keys. If your table doesn't have one, you can't do any updating of the tables until you put one in and update the DataAdpter or TableAdapter SQL statements to return that key field in the query results. ...or did I miss something in your post??
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007 -
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007