473,837 Members | 1,413 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

VB.NET DataAdapter.Upd ate

Have googled and read the VS.NET documentation can't seem to getthe answer to the following.

Environment:
Framework 1.1
VB.NET WinForm
Access database
Using all automagic tools (DataAdapter Wizard with generatedDatase t and generated Select, Update, Insert and Deletecommands, controls bound to DataSet using the AdvancedDatabin ding properties)

Issue:
Do I have to set parameters before I issue theDataSet.Upda te(Dataset, [Table])? Again, my goal is minimalcoding and let VS.NET generate everything for me. I'm hopingthere's an advance data property I need to set on each controlto bind it to the dataset. Currently the Text property on theTextboxes is bound to the dataset and the Checked properties areset on the CheckBoxes.

When I issue the command w/out setting any values it generates a"Additional information: Concurrency violation: theUpdateComman d affected 0 records." error.

Thanks for your time in advance,

Joe

VB.NET Code
*************** ****
Public Class Form2
Inherits System.Windows. Forms.Form

#Region " Windows Form Designer generated code "

Public Sub New()
MyBase.New()

'This call is required by the Windows Form Designer.
InitializeCompo nent()

'Add any initialization after the InitializeCompo nent()call

End Sub

'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing AsBoolean)
If disposing Then
If Not (components Is Nothing) Then
components.Disp ose()
End If
End If
MyBase.Dispose( disposing)
End Sub

'Required by the Windows Form Designer
Private components As System.Componen tModel.IContain er

'NOTE: The following procedure is required by the WindowsForm Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents OrgConnection AsSystem.Data.O leDb.OleDbConne ction
Friend WithEvents OrganizationAll owDelete AsSystem.Window s.Forms.CheckBo x
Friend WithEvents btnSave As System.Windows. Forms.Button
Friend WithEvents OrgAdapter AsSystem.Data.O leDb.OleDbDataA dapter
Friend WithEvents btnPrevious As System.Windows. Forms.Button
Friend WithEvents btnNext As System.Windows. Forms.Button
Friend WithEvents OrgDataSet AsWindowsApplic ation3.OrgDataS et
Friend WithEvents OrganizationID AsSystem.Window s.Forms.TextBox
Friend WithEvents OrganizationNam e AsSystem.Window s.Forms.TextBox
Friend WithEvents OleDbSelectComm and1 AsSystem.Data.O leDb.OleDbComma nd
Friend WithEvents OleDbInsertComm and1 AsSystem.Data.O leDb.OleDbComma nd
Friend WithEvents OleDbUpdateComm and1 AsSystem.Data.O leDb.OleDbComma nd
Friend WithEvents OleDbDeleteComm and1 AsSystem.Data.O leDb.OleDbComma nd
<System.Diagnos tics.DebuggerSt epThrough()> Private SubInitializeCo mponent()
Me.btnSave = New System.Windows. Forms.Button
Me.Organization ID = New System.Windows. Forms.TextBox
Me.OrgDataSet = New WindowsApplicat ion3.OrgDataSet
Me.Organization Name = New System.Windows. Forms.TextBox
Me.OrgConnectio n = New System.Data.Ole Db.OleDbConnect ion
Me.OrgAdapter = New System.Data.Ole Db.OleDbDataAda pter
Me.OleDbDeleteC ommand1 = NewSystem.Data. OleDb.OleDbComm and
Me.OleDbInsertC ommand1 = NewSystem.Data. OleDb.OleDbComm and
Me.OleDbSelectC ommand1 = NewSystem.Data. OleDb.OleDbComm and
Me.OleDbUpdateC ommand1 = NewSystem.Data. OleDb.OleDbComm and
Me.Organization AllowDelete = NewSystem.Windo ws.Forms.CheckB ox
Me.btnPrevious = New System.Windows. Forms.Button
Me.btnNext = New System.Windows. Forms.Button
CType(Me.OrgDat aSet,System.Com ponentModel.ISu pportInitialize ).BeginInit()
Me.SuspendLayou t()
'
'btnSave
'
Me.btnSave.Loca tion = New System.Drawing. Point(256, 88)
Me.btnSave.Name = "btnSave"
Me.btnSave.TabI ndex = 0
Me.btnSave.Text = "Save"
'
'OrganizationID
'
Me.Organization ID.DataBindings .Add(NewSystem. Windows.Forms.B inding("Text", Me.OrgDataSet," Organizations.O rganizationID") )
Me.Organization ID.Location = New System.Drawing. Point(0,8)
Me.Organization ID.Name = "OrganizationID "
Me.Organization ID.Size = New System.Drawing. Size(350,20)
Me.Organization ID.TabIndex = 1
Me.Organization ID.Text = "OrganizationID "
'
'OrgDataSet
'
Me.OrgDataSet.D ataSetName = "OrgDataSet "
Me.OrgDataSet.L ocale = NewSystem.Globa lization.Cultur eInfo("en-US")
'
'OrganizationNa me
'
Me.Organization Name.DataBindin gs.Add(NewSyste m.Windows.Forms .Binding("Text" , Me.OrgDataSet," Organizations.O rganizationName "))
Me.Organization Name.Location = NewSystem.Drawi ng.Point(0, 32)
Me.Organization Name.Name = "OrganizationNa me"
Me.Organization Name.Size = New System.Drawing. Size(350,20)
Me.Organization Name.TabIndex = 2
Me.Organization Name.Text = "OrganizationNa me"
'
'OrgConnection
'
Me.OrgConnectio n.ConnectionStr ing = "Jet OLEDB:GlobalPar tial Bulk Ops=2;Jet OLEDB:Registry Path=;Jet OLEDB:DatabaseL " & _
"ocking Mode=1;Jet OLEDB:Database Password=;DataS ource="{PathTo} \" & _
"Your.mdb;Passw ord=;Jet OLEDB:Engine Type=5;JetOLEDB :Globa" & _
"l BulkTransaction s=1;Provider="" Microsoft.Jet.O LEDB.4.0"";JetO LEDB:System databa" & _
"se=;Jet OLEDB:SFP=False ;Extended Properties=;Mod e=ShareDeny None;Jet OLEDB:New " & _
"Database Password=;Jet OLEDB:Create SystemDatabase= False;Jet OLEDB:Don't Copy L" & _
"ocale on Compact=False;J et OLEDB:Compact Without ReplicaRepair=F alse;User ID=Ad" & _
"min;Jet OLEDB:Encrypt Database=False"
'
'OrgAdapter
'
Me.OrgAdapter.D eleteCommand = Me.OleDbDeleteC ommand1
Me.OrgAdapter.I nsertCommand = Me.OleDbInsertC ommand1
Me.OrgAdapter.M issingSchemaAct ion =System.Data.Mi ssingSchemaActi on.AddWithKey
Me.OrgAdapter.S electCommand = Me.OleDbSelectC ommand1
Me.OrgAdapter.T ableMappings.Ad dRange(NewSyste m.Data.Common.D ataTableMapping () {NewSystem.Data .Common.DataTab leMapping("Tabl e", "Organizations" ,New System.Data.Com mon.DataColumnM apping() {NewSystem.Data .Common.DataCol umnMapping("Las tModifiedDate", "LastModifiedDa te"), NewSystem.Data. Common.DataColu mnMapping("Last ModifiedUser"," LastModifiedUse r"), NewSystem.Data. Common.DataColu mnMapping("Orga nizationAbbrv", "OrganizationAb brv"), NewSystem.Data. Common.DataColu mnMapping("Orga nizationAllowDe lete","Organiza tionAllowDelete "), NewSystem.Data. Common.DataColu mnMapping("Orga nizationDescrip tion","Organiza tionDescription "), NewSystem.Data. Common.DataColu mnMapping("Orga nizationID","Or ganizationID"), NewSystem.Data. Common.DataColu mnMapping("Orga nizationIsRoot" ,"OrganizationI sRoot"), NewSystem.Data. Common.DataColu mnMapping("Orga nizationName"," OrganizationNam e"), NewSystem.Data. Common.DataColu mnMapping("Orga nizationNode"," OrganizationNod e")})})
Me.OrgAdapter.U pdateCommand = Me.OleDbUpdateC ommand1
'
'OleDbDeleteCom mand1
'
Me.OleDbDeleteC ommand1.Command Text = "DELETE FROMOrganizatio ns WHERE (OrganizationID = ?) AND (LastModifiedDa te =?) A" & _
"ND (LastModifiedUs er = ?) AND (OrganizationAb brv = ? OR? IS NULL AND Organizati" & _
"onAbbrv IS NULL) AND (OrganizationAl lowDelete = ?) AND(Organizatio nIsRoot = ?) " & _
"AND (OrganizationNa me = ?) AND (OrganizationNo de = ?)"
Me.OleDbDeleteC ommand1.Connect ion = Me.OrgConnectio n
Me.OleDbDeleteC ommand1.Paramet ers.Add(NewSyst em.Data.OleDb.O leDbParameter(" Original_Organi zationID",Syste m.Data.OleDb.Ol eDbType.Guid, 0,System.Data.P arameterDirecti on.Input, False, CType(0, Byte),CType(0, Byte), "OrganizationID ",System.Data.D ataRowVersion.O riginal, Nothing))
Me.OleDbDeleteC ommand1.Paramet ers.Add(NewSyst em.Data.OleDb.O leDbParameter(" Original_LastMo difiedDate",Sys tem.Data.OleDb. OleDbType.DBDat e, 0,System.Data.P arameterDirecti on.Input, False, CType(0, Byte),CType(0, Byte), "LastModifiedDa te",System.Data .DataRowVersion .Original, Nothing))
Me.OleDbDeleteC ommand1.Paramet ers.Add(NewSyst em.Data.OleDb.O leDbParameter(" Original_LastMo difiedUser",Sys tem.Data.OleDb. OleDbType.VarWC har, 30,System.Data. ParameterDirect ion.Input, False, CType(0, Byte),CType(0, Byte), "LastModifiedUs er",System.Data .DataRowVersion .Original, Nothing))
Me.OleDbDeleteC ommand1.Paramet ers.Add(NewSyst em.Data.OleDb.O leDbParameter(" Original_Organi zationAbbrv",Sy stem.Data.OleDb .OleDbType.VarW Char, 10,System.Data. ParameterDirect ion.Input, False, CType(0, Byte),CType(0, Byte), "OrganizationAb brv",System.Dat a.DataRowVersio n.Original, Nothing))
Me.OleDbDeleteC ommand1.Paramet ers.Add(NewSyst em.Data.OleDb.O leDbParameter(" Original_Organi zationAbbrv1",S ystem.Data.OleD b.OleDbType.Var WChar, 10,System.Data. ParameterDirect ion.Input, False, CType(0, Byte),CType(0, Byte), "OrganizationAb brv",System.Dat a.DataRowVersio n.Original, Nothing))
Me.OleDbDeleteC ommand1.Paramet ers.Add(NewSyst em.Data.OleDb.O leDbParameter(" Original_Organi zationAllowDele te", System.Data.Ole Db.OleDbType.De cimal, 0,System.Data.P arameterDirecti on.Input, False, CType(1, Byte),CType(0, Byte), "OrganizationAl lowDelete",Syst em.Data.DataRow Version.Origina l, Nothing))
Me.OleDbDeleteC ommand1.Paramet ers.Add(NewSyst em.Data.OleDb.O leDbParameter(" Original_Organi zationIsRoot",S ystem.Data.OleD b.OleDbType.Dec imal, 0,System.Data.P arameterDirecti on.Input, False, CType(1, Byte),CType(0, Byte), "OrganizationIs Root",System.Da ta.DataRowVersi on.Original, Nothing))
Me.OleDbDeleteC ommand1.Paramet ers.Add(NewSyst em.Data.OleDb.O leDbParameter(" Original_Organi zationName",Sys tem.Data.OleDb. OleDbType.VarWC har, 100,System.Data .ParameterDirec tion.Input, False, CType(0, Byte),CType(0, Byte), "OrganizationNa me",System.Data .DataRowVersion .Original, Nothing))
Me.OleDbDeleteC ommand1.Paramet ers.Add(NewSyst em.Data.OleDb.O leDbParameter(" Original_Organi zationNode",Sys tem.Data.OleDb. OleDbType.VarWC har, 100,System.Data .ParameterDirec tion.Input, False, CType(0, Byte),CType(0, Byte), "OrganizationNo de",System.Data .DataRowVersion .Original, Nothing))
'
'OleDbInsertCom mand1
'
Me.OleDbInsertC ommand1.Command Text = "INSERT INTOOrganizatio ns(LastModified Date, LastModifiedUse r,OrganizationA bbrv, " & _
"OrganizationAl lowDelete, OrganizationDes cription,Organi zationID, OrganizationIs" & _
"Root, OrganizationNam e, OrganizationNod e) VALUES (?, ?,?, ?, ?, ?, ?, ?, ?)"
Me.OleDbInsertC ommand1.Connect ion = Me.OrgConnectio n
Me.OleDbInsertC ommand1.Paramet ers.Add(NewSyst em.Data.OleDb.O leDbParameter(" LastModifiedDat e",System.Data. OleDb.OleDbType .DBDate, 0, "LastModifiedDa te"))
Me.OleDbInsertC ommand1.Paramet ers.Add(NewSyst em.Data.OleDb.O leDbParameter(" LastModifiedUse r",System.Data. OleDb.OleDbType .VarWChar, 30, "LastModifiedUs er"))
Me.OleDbInsertC ommand1.Paramet ers.Add(NewSyst em.Data.OleDb.O leDbParameter(" OrganizationAbb rv",System.Data .OleDb.OleDbTyp e.VarWChar, 10, "OrganizationAb brv"))
Me.OleDbInsertC ommand1.Paramet ers.Add(NewSyst em.Data.OleDb.O leDbParameter(" OrganizationAll owDelete",Syste m.Data.OleDb.Ol eDbType.Decimal , 0,System.Data.P arameterDirecti on.Input, False, CType(1, Byte),CType(0, Byte), "OrganizationAl lowDelete",Syst em.Data.DataRow Version.Current , Nothing))
Me.OleDbInsertC ommand1.Paramet ers.Add(NewSyst em.Data.OleDb.O leDbParameter(" OrganizationDes cription",Syste m.Data.OleDb.Ol eDbType.VarWCha r, 0,"Organization Description"))
Me.OleDbInsertC ommand1.Paramet ers.Add(NewSyst em.Data.OleDb.O leDbParameter(" OrganizationID" ,System.Data.Ol eDb.OleDbType.G uid, 0, "OrganizationID "))
Me.OleDbInsertC ommand1.Paramet ers.Add(NewSyst em.Data.OleDb.O leDbParameter(" OrganizationIsR oot",System.Dat a.OleDb.OleDbTy pe.Decimal, 0,System.Data.P arameterDirecti on.Input, False, CType(1, Byte),CType(0, Byte), "OrganizationIs Root",System.Da ta.DataRowVersi on.Current, Nothing))
Me.OleDbInsertC ommand1.Paramet ers.Add(NewSyst em.Data.OleDb.O leDbParameter(" OrganizationNam e",System.Data. OleDb.OleDbType .VarWChar, 100, "OrganizationNa me"))
Me.OleDbInsertC ommand1.Paramet ers.Add(NewSyst em.Data.OleDb.O leDbParameter(" OrganizationNod e",System.Data. OleDb.OleDbType .VarWChar, 100, "OrganizationNo de"))
'
'OleDbSelectCom mand1
'
Me.OleDbSelectC ommand1.Command Text = "SELECTLastModi fiedDate, LastModifiedUse r, OrganizationAbb rv,Organization AllowDe" & _
"lete, OrganizationDes cription, OrganizationID, OrganizationIsR oot, OrganizationN" & _
"ame, OrganizationNod e FROM Organizations"
Me.OleDbSelectC ommand1.Connect ion = Me.OrgConnectio n
'
'OleDbUpdateCom mand1
'
Me.OleDbUpdateC ommand1.Command Text = "UPDATEOrganiza tions SET LastModifiedDat e = ?, LastModifiedUse r = ?,Organization" & _
"Abbrv = ?, OrganizationAll owDelete = ?,OrganizationD escription = ?, Organizatio" & _
"nID = ?, OrganizationIsR oot = ?, OrganizationNam e = ?,OrganizationN ode = ? WHER" & _
"E (OrganizationID = ?) AND (LastModifiedDa te = ?) AND(LastModifie dUser = ?) AND" & _
" (OrganizationAb brv = ? OR ? IS NULL ANDOrganization Abbrv IS NULL) AND (Organiz" & _
"ationAllowDele te = ?) AND (OrganizationIs Root = ?) AND(Organizatio nName = ?) AN" & _
"D (OrganizationNo de = ?)"
Me.OleDbUpdateC ommand1.Connect ion = Me.OrgConnectio n
Me.OleDbUpdateC ommand1.Paramet ers.Add(NewSyst em.Data.OleDb.O leDbParameter(" LastModifiedDat e",System.Data. OleDb.OleDbType .DBDate, 0, "LastModifiedDa te"))
Me.OleDbUpdateC ommand1.Paramet ers.Add(NewSyst em.Data.OleDb.O leDbParameter(" LastModifiedUse r",System.Data. OleDb.OleDbType .VarWChar, 30, "LastModifiedUs er"))
Me.OleDbUpdateC ommand1.Paramet ers.Add(NewSyst em.Data.OleDb.O leDbParameter(" OrganizationAbb rv",System.Data .OleDb.OleDbTyp e.VarWChar, 10, "OrganizationAb brv"))
Me.OleDbUpdateC ommand1.Paramet ers.Add(NewSyst em.Data.OleDb.O leDbParameter(" OrganizationAll owDelete",Syste m.Data.OleDb.Ol eDbType.Decimal , 0,System.Data.P arameterDirecti on.Input, False, CType(1, Byte),CType(0, Byte), "OrganizationAl lowDelete",Syst em.Data.DataRow Version.Current , Nothing))
Me.OleDbUpdateC ommand1.Paramet ers.Add(NewSyst em.Data.OleDb.O leDbParameter(" OrganizationDes cription",Syste m.Data.OleDb.Ol eDbType.VarWCha r, 0,"Organization Description"))
Me.OleDbUpdateC ommand1.Paramet ers.Add(NewSyst em.Data.OleDb.O leDbParameter(" OrganizationID" ,System.Data.Ol eDb.OleDbType.G uid, 0, "OrganizationID "))
Me.OleDbUpdateC ommand1.Paramet ers.Add(NewSyst em.Data.OleDb.O leDbParameter(" OrganizationIsR oot",System.Dat a.OleDb.OleDbTy pe.Decimal, 0,System.Data.P arameterDirecti on.Input, False, CType(1, Byte),CType(0, Byte), "OrganizationIs Root",System.Da ta.DataRowVersi on.Current, Nothing))
Me.OleDbUpdateC ommand1.Paramet ers.Add(NewSyst em.Data.OleDb.O leDbParameter(" OrganizationNam e",System.Data. OleDb.OleDbType .VarWChar, 100, "OrganizationNa me"))
Me.OleDbUpdateC ommand1.Paramet ers.Add(NewSyst em.Data.OleDb.O leDbParameter(" OrganizationNod e",System.Data. OleDb.OleDbType .VarWChar, 100, "OrganizationNo de"))
Me.OleDbUpdateC ommand1.Paramet ers.Add(NewSyst em.Data.OleDb.O leDbParameter(" Original_Organi zationID",Syste m.Data.OleDb.Ol eDbType.Guid, 0,System.Data.P arameterDirecti on.Input, False, CType(0, Byte),CType(0, Byte), "OrganizationID ",System.Data.D ataRowVersion.O riginal, Nothing))
Me.OleDbUpdateC ommand1.Paramet ers.Add(NewSyst em.Data.OleDb.O leDbParameter(" Original_LastMo difiedDate",Sys tem.Data.OleDb. OleDbType.DBDat e, 0,System.Data.P arameterDirecti on.Input, False, CType(0, Byte),CType(0, Byte), "LastModifiedDa te",System.Data .DataRowVersion .Original, Nothing))
Me.OleDbUpdateC ommand1.Paramet ers.Add(NewSyst em.Data.OleDb.O leDbParameter(" Original_LastMo difiedUser",Sys tem.Data.OleDb. OleDbType.VarWC har, 30,System.Data. ParameterDirect ion.Input, False, CType(0, Byte),CType(0, Byte), "LastModifiedUs er",System.Data .DataRowVersion .Original, Nothing))
Me.OleDbUpdateC ommand1.Paramet ers.Add(NewSyst em.Data.OleDb.O leDbParameter(" Original_Organi zationAbbrv",Sy stem.Data.OleDb .OleDbType.VarW Char, 10,System.Data. ParameterDirect ion.Input, False, CType(0, Byte),CType(0, Byte), "OrganizationAb brv",System.Dat a.DataRowVersio n.Original, Nothing))
Me.OleDbUpdateC ommand1.Paramet ers.Add(NewSyst em.Data.OleDb.O leDbParameter(" Original_Organi zationAbbrv1",S ystem.Data.OleD b.OleDbType.Var WChar, 10,System.Data. ParameterDirect ion.Input, False, CType(0, Byte),CType(0, Byte), "OrganizationAb brv",System.Dat a.DataRowVersio n.Original, Nothing))
Me.OleDbUpdateC ommand1.Paramet ers.Add(NewSyst em.Data.OleDb.O leDbParameter(" Original_Organi zationAllowDele te", System.Data.Ole Db.OleDbType.De cimal, 0,System.Data.P arameterDirecti on.Input, False, CType(1, Byte),CType(0, Byte), "OrganizationAl lowDelete",Syst em.Data.DataRow Version.Origina l, Nothing))
Me.OleDbUpdateC ommand1.Paramet ers.Add(NewSyst em.Data.OleDb.O leDbParameter(" Original_Organi zationIsRoot",S ystem.Data.OleD b.OleDbType.Dec imal, 0,System.Data.P arameterDirecti on.Input, False, CType(1, Byte),CType(0, Byte), "OrganizationIs Root",System.Da ta.DataRowVersi on.Original, Nothing))
Me.OleDbUpdateC ommand1.Paramet ers.Add(NewSyst em.Data.OleDb.O leDbParameter(" Original_Organi zationName",Sys tem.Data.OleDb. OleDbType.VarWC har, 100,System.Data .ParameterDirec tion.Input, False, CType(0, Byte),CType(0, Byte), "OrganizationNa me",System.Data .DataRowVersion .Original, Nothing))
Me.OleDbUpdateC ommand1.Paramet ers.Add(NewSyst em.Data.OleDb.O leDbParameter(" Original_Organi zationNode",Sys tem.Data.OleDb. OleDbType.VarWC har, 100,System.Data .ParameterDirec tion.Input, False, CType(0, Byte),CType(0, Byte), "OrganizationNo de",System.Data .DataRowVersion .Original, Nothing))
'
'OrganizationAl lowDelete
'
Me.Organization AllowDelete.Dat aBindings.Add(N ewSystem.Window s.Forms.Binding ("Checked", Me.OrgDataSet," Organizations.O rganizationAllo wDelete"))
Me.Organization AllowDelete.Loc ation = NewSystem.Drawi ng.Point(88, 56)
Me.Organization AllowDelete.Nam e ="OrganizationA llowDelete"
Me.Organization AllowDelete.Siz e = NewSystem.Drawi ng.Size(168, 24)
Me.Organization AllowDelete.Tab Index = 9
Me.Organization AllowDelete.Tex t ="OrganizationA llowDelete"
'
'btnPrevious
'
Me.btnPrevious. Location = New System.Drawing. Point(16,88)
Me.btnPrevious. Name = "btnPreviou s"
Me.btnPrevious. TabIndex = 11
Me.btnPrevious. Text = "Previous"
'
'btnNext
'
Me.btnNext.Loca tion = New System.Drawing. Point(128, 88)
Me.btnNext.Name = "btnNext"
Me.btnNext.TabI ndex = 12
Me.btnNext.Text = "Next"
'
'Form2
'
Me.AutoScaleBas eSize = New System.Drawing. Size(5, 13)
Me.ClientSize = New System.Drawing. Size(352, 117)
Me.Controls.Add (Me.btnNext)
Me.Controls.Add (Me.btnPrevious )
Me.Controls.Add (Me.Organizatio nAllowDelete)
Me.Controls.Add (Me.Organizatio nName)
Me.Controls.Add (Me.Organizatio nID)
Me.Controls.Add (Me.btnSave)
Me.Name = "Form2"
Me.Text = "Form1"
CType(Me.OrgDat aSet,System.Com ponentModel.ISu pportInitialize ).EndInit()
Me.ResumeLayout (False)

End Sub

#End Region

Private Sub Form1_Load(ByVa l sender As Object, ByVal e AsSystem.EventA rgs) Handles MyBase.Load
Me.OrgAdapter.F ill(Me.OrgDataS et)
End Sub

Private Sub btnNext_Click(B yVal sender As System.Object,B yVal e As System.EventArg s) Handles btnNext.Click
MoveRecord(1)
End Sub

Private Sub btnPrevious_Cli ck(ByVal sender As System.Object,B yVal e As System.EventArg s) Handles btnPrevious.Cli ck
MoveRecord(-1)
End Sub
Private Sub MoveRecord(ByVa l Count As Integer)
Me.BindingConte xt(Me.OrgDataSe t,"Organization s").Position += Count
End Sub

Private Sub btnSave_Click(B yVal sender As System.Object,B yVal e As System.EventArg s) Handles btnSave.Click
Me.OrgAdapter.U pdate(Me.OrgDat aSet, "Organizations" )
End Sub
End Class

--------------------------------
From: Joe Fetters

-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)

<Id>txqPPDwRE0m Prb+Ji1A9Kg==</Id>
Nov 17 '05 #1
2 2882
Joe,

There can be a number of reasons that this happens. If you have a
timestamp (of some sort) on your table, then this error can come up if a
change was made to the database to the version you were working on. If you
don't have a timestamp of some sort, and you don't have a primary key, then
VS.NET will generate a query that will check each field in the table against
the values, to see which one to update. If it can't find the record to
update, then you will get this error as well.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m
"Joe Fetters via .NET 247" <an*******@dotn et247.com> wrote in message
news:%2******** *******@TK2MSFT NGP12.phx.gbl.. .
Have googled and read the VS.NET documentation can't seem to get the answer
to the following.

Environment:
Framework 1.1
VB.NET WinForm
Access database
Using all automagic tools (DataAdapter Wizard with generated Dataset and
generated Select, Update, Insert and Delete commands, controls bound to
DataSet using the Advanced Databinding properties)

Issue:
Do I have to set parameters before I issue the DataSet.Update( Dataset,
[Table])? Again, my goal is minimal coding and let VS.NET generate
everything for me. I'm hoping there's an advance data property I need to
set on each control to bind it to the dataset. Currently the Text property
on the Textboxes is bound to the dataset and the Checked properties are set
on the CheckBoxes.

When I issue the command w/out setting any values it generates a "Additional
information: Concurrency violation: the UpdateCommand affected 0 records."
error.

Thanks for your time in advance,

Joe

VB.NET Code
*************** ****
Public Class Form2
Inherits System.Windows. Forms.Form

#Region " Windows Form Designer generated code "

Public Sub New()
MyBase.New()

'This call is required by the Windows Form Designer.
InitializeCompo nent()

'Add any initialization after the InitializeCompo nent() call

End Sub

'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Disp ose()
End If
End If
MyBase.Dispose( disposing)
End Sub

'Required by the Windows Form Designer
Private components As System.Componen tModel.IContain er

'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents OrgConnection As System.Data.Ole Db.OleDbConnect ion
Friend WithEvents OrganizationAll owDelete As
System.Windows. Forms.CheckBox
Friend WithEvents btnSave As System.Windows. Forms.Button
Friend WithEvents OrgAdapter As System.Data.Ole Db.OleDbDataAda pter
Friend WithEvents btnPrevious As System.Windows. Forms.Button
Friend WithEvents btnNext As System.Windows. Forms.Button
Friend WithEvents OrgDataSet As WindowsApplicat ion3.OrgDataSet
Friend WithEvents OrganizationID As System.Windows. Forms.TextBox
Friend WithEvents OrganizationNam e As System.Windows. Forms.TextBox
Friend WithEvents OleDbSelectComm and1 As System.Data.Ole Db.OleDbCommand
Friend WithEvents OleDbInsertComm and1 As System.Data.Ole Db.OleDbCommand
Friend WithEvents OleDbUpdateComm and1 As System.Data.Ole Db.OleDbCommand
Friend WithEvents OleDbDeleteComm and1 As System.Data.Ole Db.OleDbCommand
<System.Diagnos tics.DebuggerSt epThrough()> Private Sub
InitializeCompo nent()
Me.btnSave = New System.Windows. Forms.Button
Me.Organization ID = New System.Windows. Forms.TextBox
Me.OrgDataSet = New WindowsApplicat ion3.OrgDataSet
Me.Organization Name = New System.Windows. Forms.TextBox
Me.OrgConnectio n = New System.Data.Ole Db.OleDbConnect ion
Me.OrgAdapter = New System.Data.Ole Db.OleDbDataAda pter
Me.OleDbDeleteC ommand1 = New System.Data.Ole Db.OleDbCommand
Me.OleDbInsertC ommand1 = New System.Data.Ole Db.OleDbCommand
Me.OleDbSelectC ommand1 = New System.Data.Ole Db.OleDbCommand
Me.OleDbUpdateC ommand1 = New System.Data.Ole Db.OleDbCommand
Me.Organization AllowDelete = New System.Windows. Forms.CheckBox
Me.btnPrevious = New System.Windows. Forms.Button
Me.btnNext = New System.Windows. Forms.Button
CType(Me.OrgDat aSet,
System.Componen tModel.ISupport Initialize).Beg inInit()
Me.SuspendLayou t()
'
'btnSave
'
Me.btnSave.Loca tion = New System.Drawing. Point(256, 88)
Me.btnSave.Name = "btnSave"
Me.btnSave.TabI ndex = 0
Me.btnSave.Text = "Save"
'
'OrganizationID
'
Me.Organization ID.DataBindings .Add(New
System.Windows. Forms.Binding(" Text", Me.OrgDataSet,
"Organizations. OrganizationID" ))
Me.Organization ID.Location = New System.Drawing. Point(0, 8)
Me.Organization ID.Name = "OrganizationID "
Me.Organization ID.Size = New System.Drawing. Size(350, 20)
Me.Organization ID.TabIndex = 1
Me.Organization ID.Text = "OrganizationID "
'
'OrgDataSet
'
Me.OrgDataSet.D ataSetName = "OrgDataSet "
Me.OrgDataSet.L ocale = New System.Globaliz ation.CultureIn fo("en-US")
'
'OrganizationNa me
'
Me.Organization Name.DataBindin gs.Add(New
System.Windows. Forms.Binding(" Text", Me.OrgDataSet,
"Organizations. OrganizationNam e"))
Me.Organization Name.Location = New System.Drawing. Point(0, 32)
Me.Organization Name.Name = "OrganizationNa me"
Me.Organization Name.Size = New System.Drawing. Size(350, 20)
Me.Organization Name.TabIndex = 2
Me.Organization Name.Text = "OrganizationNa me"
'
'OrgConnection
'
Me.OrgConnectio n.ConnectionStr ing = "Jet OLEDB:Global Partial Bulk
Ops=2;Jet OLEDB:Registry Path=;Jet OLEDB:Database L" & _
"ocking Mode=1;Jet OLEDB:Database Password=;Data Source="{PathTo }\"
& _
"Your.mdb;Passw ord=;Jet OLEDB:Engine Type=5;Jet OLEDB:Globa" & _
"l Bulk Transactions=1; Provider=""Micr osoft.Jet.OLEDB .4.0"";Jet
OLEDB:System databa" & _
"se=;Jet OLEDB:SFP=False ;Extended Properties=;Mod e=Share Deny
None;Jet OLEDB:New " & _
"Database Password=;Jet OLEDB:Create System Database=False; Jet
OLEDB:Don't Copy L" & _
"ocale on Compact=False;J et OLEDB:Compact Without Replica
Repair=False;Us er ID=Ad" & _
"min;Jet OLEDB:Encrypt Database=False"
'
'OrgAdapter
'
Me.OrgAdapter.D eleteCommand = Me.OleDbDeleteC ommand1
Me.OrgAdapter.I nsertCommand = Me.OleDbInsertC ommand1
Me.OrgAdapter.M issingSchemaAct ion =
System.Data.Mis singSchemaActio n.AddWithKey
Me.OrgAdapter.S electCommand = Me.OleDbSelectC ommand1
Me.OrgAdapter.T ableMappings.Ad dRange(New
System.Data.Com mon.DataTableMa pping() {New
System.Data.Com mon.DataTableMa pping("Table", "Organizations" , New
System.Data.Com mon.DataColumnM apping() {New
System.Data.Com mon.DataColumnM apping("LastMod ifiedDate",
"LastModifiedDa te"), New
System.Data.Com mon.DataColumnM apping("LastMod ifiedUser",
"LastModifiedUs er"), New
System.Data.Com mon.DataColumnM apping("Organiz ationAbbrv",
"OrganizationAb brv"), New
System.Data.Com mon.DataColumnM apping("Organiz ationAllowDelet e",
"OrganizationAl lowDelete"), New
System.Data.Com mon.DataColumnM apping("Organiz ationDescriptio n",
"OrganizationDe scription"), New
System.Data.Com mon.DataColumnM apping("Organiz ationID", "OrganizationID "),
New System.Data.Com mon.DataColumnM apping("Organiz ationIsRoot",
"OrganizationIs Root"), New
System.Data.Com mon.DataColumnM apping("Organiz ationName",
"OrganizationNa me"), New
System.Data.Com mon.DataColumnM apping("Organiz ationNode",
"OrganizationNo de")})})
Me.OrgAdapter.U pdateCommand = Me.OleDbUpdateC ommand1
'
'OleDbDeleteCom mand1
'
Me.OleDbDeleteC ommand1.Command Text = "DELETE FROM Organizations
WHERE (OrganizationID = ?) AND (LastModifiedDa te = ?) A" & _
"ND (LastModifiedUs er = ?) AND (OrganizationAb brv = ? OR ? IS NULL
AND Organizati" & _
"onAbbrv IS NULL) AND (OrganizationAl lowDelete = ?) AND
(OrganizationIs Root = ?) " & _
"AND (OrganizationNa me = ?) AND (OrganizationNo de = ?)"
Me.OleDbDeleteC ommand1.Connect ion = Me.OrgConnectio n
Me.OleDbDeleteC ommand1.Paramet ers.Add(New
System.Data.Ole Db.OleDbParamet er("Original_Or ganizationID",
System.Data.Ole Db.OleDbType.Gu id, 0, System.Data.Par ameterDirection .Input,
False, CType(0, Byte), CType(0, Byte), "OrganizationID ",
System.Data.Dat aRowVersion.Ori ginal, Nothing))
Me.OleDbDeleteC ommand1.Paramet ers.Add(New
System.Data.Ole Db.OleDbParamet er("Original_La stModifiedDate" ,
System.Data.Ole Db.OleDbType.DB Date, 0, System.Data.Par ameterDirection .Input,
False, CType(0, Byte), CType(0, Byte), "LastModifiedDa te",
System.Data.Dat aRowVersion.Ori ginal, Nothing))
Me.OleDbDeleteC ommand1.Paramet ers.Add(New
System.Data.Ole Db.OleDbParamet er("Original_La stModifiedUser" ,
System.Data.Ole Db.OleDbType.Va rWChar, 30,
System.Data.Par ameterDirection .Input, False, CType(0, Byte), CType(0, Byte),
"LastModifiedUs er", System.Data.Dat aRowVersion.Ori ginal, Nothing))
Me.OleDbDeleteC ommand1.Paramet ers.Add(New
System.Data.Ole Db.OleDbParamet er("Original_Or ganizationAbbrv ",
System.Data.Ole Db.OleDbType.Va rWChar, 10,
System.Data.Par ameterDirection .Input, False, CType(0, Byte), CType(0, Byte),
"OrganizationAb brv", System.Data.Dat aRowVersion.Ori ginal, Nothing))
Me.OleDbDeleteC ommand1.Paramet ers.Add(New
System.Data.Ole Db.OleDbParamet er("Original_Or ganizationAbbrv 1",
System.Data.Ole Db.OleDbType.Va rWChar, 10,
System.Data.Par ameterDirection .Input, False, CType(0, Byte), CType(0, Byte),
"OrganizationAb brv", System.Data.Dat aRowVersion.Ori ginal, Nothing))
Me.OleDbDeleteC ommand1.Paramet ers.Add(New
System.Data.Ole Db.OleDbParamet er("Original_Or ganizationAllow Delete",
System.Data.Ole Db.OleDbType.De cimal, 0,
System.Data.Par ameterDirection .Input, False, CType(1, Byte), CType(0, Byte),
"OrganizationAl lowDelete", System.Data.Dat aRowVersion.Ori ginal, Nothing))
Me.OleDbDeleteC ommand1.Paramet ers.Add(New
System.Data.Ole Db.OleDbParamet er("Original_Or ganizationIsRoo t",
System.Data.Ole Db.OleDbType.De cimal, 0,
System.Data.Par ameterDirection .Input, False, CType(1, Byte), CType(0, Byte),
"OrganizationIs Root", System.Data.Dat aRowVersion.Ori ginal, Nothing))
Me.OleDbDeleteC ommand1.Paramet ers.Add(New
System.Data.Ole Db.OleDbParamet er("Original_Or ganizationName" ,
System.Data.Ole Db.OleDbType.Va rWChar, 100,
System.Data.Par ameterDirection .Input, False, CType(0, Byte), CType(0, Byte),
"OrganizationNa me", System.Data.Dat aRowVersion.Ori ginal, Nothing))
Me.OleDbDeleteC ommand1.Paramet ers.Add(New
System.Data.Ole Db.OleDbParamet er("Original_Or ganizationNode" ,
System.Data.Ole Db.OleDbType.Va rWChar, 100,
System.Data.Par ameterDirection .Input, False, CType(0, Byte), CType(0, Byte),
"OrganizationNo de", System.Data.Dat aRowVersion.Ori ginal, Nothing))
'
'OleDbInsertCom mand1
'
Me.OleDbInsertC ommand1.Command Text = "INSERT INTO
Organizations(L astModifiedDate , LastModifiedUse r, OrganizationAbb rv, " & _
"OrganizationAl lowDelete, OrganizationDes cription, OrganizationID,
OrganizationIs" & _
"Root, OrganizationNam e, OrganizationNod e) VALUES (?, ?, ?, ?, ?, ?,
?, ?, ?)"
Me.OleDbInsertC ommand1.Connect ion = Me.OrgConnectio n
Me.OleDbInsertC ommand1.Paramet ers.Add(New
System.Data.Ole Db.OleDbParamet er("LastModifie dDate",
System.Data.Ole Db.OleDbType.DB Date, 0, "LastModifiedDa te"))
Me.OleDbInsertC ommand1.Paramet ers.Add(New
System.Data.Ole Db.OleDbParamet er("LastModifie dUser",
System.Data.Ole Db.OleDbType.Va rWChar, 30, "LastModifiedUs er"))
Me.OleDbInsertC ommand1.Paramet ers.Add(New
System.Data.Ole Db.OleDbParamet er("Organizatio nAbbrv",
System.Data.Ole Db.OleDbType.Va rWChar, 10, "OrganizationAb brv"))
Me.OleDbInsertC ommand1.Paramet ers.Add(New
System.Data.Ole Db.OleDbParamet er("Organizatio nAllowDelete",
System.Data.Ole Db.OleDbType.De cimal, 0,
System.Data.Par ameterDirection .Input, False, CType(1, Byte), CType(0, Byte),
"OrganizationAl lowDelete", System.Data.Dat aRowVersion.Cur rent, Nothing))
Me.OleDbInsertC ommand1.Paramet ers.Add(New
System.Data.Ole Db.OleDbParamet er("Organizatio nDescription",
System.Data.Ole Db.OleDbType.Va rWChar, 0, "OrganizationDe scription"))
Me.OleDbInsertC ommand1.Paramet ers.Add(New
System.Data.Ole Db.OleDbParamet er("Organizatio nID",
System.Data.Ole Db.OleDbType.Gu id, 0, "OrganizationID "))
Me.OleDbInsertC ommand1.Paramet ers.Add(New
System.Data.Ole Db.OleDbParamet er("Organizatio nIsRoot",
System.Data.Ole Db.OleDbType.De cimal, 0,
System.Data.Par ameterDirection .Input, False, CType(1, Byte), CType(0, Byte),
"OrganizationIs Root", System.Data.Dat aRowVersion.Cur rent, Nothing))
Me.OleDbInsertC ommand1.Paramet ers.Add(New
System.Data.Ole Db.OleDbParamet er("Organizatio nName",
System.Data.Ole Db.OleDbType.Va rWChar, 100, "OrganizationNa me"))
Me.OleDbInsertC ommand1.Paramet ers.Add(New
System.Data.Ole Db.OleDbParamet er("Organizatio nNode",
System.Data.Ole Db.OleDbType.Va rWChar, 100, "OrganizationNo de"))
'
'OleDbSelectCom mand1
'
Me.OleDbSelectC ommand1.Command Text = "SELECT LastModifiedDat e,
LastModifiedUse r, OrganizationAbb rv, OrganizationAll owDe" & _
"lete, OrganizationDes cription, OrganizationID, OrganizationIsR oot,
OrganizationN" & _
"ame, OrganizationNod e FROM Organizations"
Me.OleDbSelectC ommand1.Connect ion = Me.OrgConnectio n
'
'OleDbUpdateCom mand1
'
Me.OleDbUpdateC ommand1.Command Text = "UPDATE Organizations SET
LastModifiedDat e = ?, LastModifiedUse r = ?, Organization" & _
"Abbrv = ?, OrganizationAll owDelete = ?, OrganizationDes cription =
?, Organizatio" & _
"nID = ?, OrganizationIsR oot = ?, OrganizationNam e = ?,
OrganizationNod e = ? WHER" & _
"E (OrganizationID = ?) AND (LastModifiedDa te = ?) AND
(LastModifiedUs er = ?) AND" & _
" (OrganizationAb brv = ? OR ? IS NULL AND OrganizationAbb rv IS NULL)
AND (Organiz" & _
"ationAllowDele te = ?) AND (OrganizationIs Root = ?) AND
(OrganizationNa me = ?) AN" & _
"D (OrganizationNo de = ?)"
Me.OleDbUpdateC ommand1.Connect ion = Me.OrgConnectio n
Me.OleDbUpdateC ommand1.Paramet ers.Add(New
System.Data.Ole Db.OleDbParamet er("LastModifie dDate",
System.Data.Ole Db.OleDbType.DB Date, 0, "LastModifiedDa te"))
Me.OleDbUpdateC ommand1.Paramet ers.Add(New
System.Data.Ole Db.OleDbParamet er("LastModifie dUser",
System.Data.Ole Db.OleDbType.Va rWChar, 30, "LastModifiedUs er"))
Me.OleDbUpdateC ommand1.Paramet ers.Add(New
System.Data.Ole Db.OleDbParamet er("Organizatio nAbbrv",
System.Data.Ole Db.OleDbType.Va rWChar, 10, "OrganizationAb brv"))
Me.OleDbUpdateC ommand1.Paramet ers.Add(New
System.Data.Ole Db.OleDbParamet er("Organizatio nAllowDelete",
System.Data.Ole Db.OleDbType.De cimal, 0,
System.Data.Par ameterDirection .Input, False, CType(1, Byte), CType(0, Byte),
"OrganizationAl lowDelete", System.Data.Dat aRowVersion.Cur rent, Nothing))
Me.OleDbUpdateC ommand1.Paramet ers.Add(New
System.Data.Ole Db.OleDbParamet er("Organizatio nDescription",
System.Data.Ole Db.OleDbType.Va rWChar, 0, "OrganizationDe scription"))
Me.OleDbUpdateC ommand1.Paramet ers.Add(New
System.Data.Ole Db.OleDbParamet er("Organizatio nID",
System.Data.Ole Db.OleDbType.Gu id, 0, "OrganizationID "))
Me.OleDbUpdateC ommand1.Paramet ers.Add(New
System.Data.Ole Db.OleDbParamet er("Organizatio nIsRoot",
System.Data.Ole Db.OleDbType.De cimal, 0,
System.Data.Par ameterDirection .Input, False, CType(1, Byte), CType(0, Byte),
"OrganizationIs Root", System.Data.Dat aRowVersion.Cur rent, Nothing))
Me.OleDbUpdateC ommand1.Paramet ers.Add(New
System.Data.Ole Db.OleDbParamet er("Organizatio nName",
System.Data.Ole Db.OleDbType.Va rWChar, 100, "OrganizationNa me"))
Me.OleDbUpdateC ommand1.Paramet ers.Add(New
System.Data.Ole Db.OleDbParamet er("Organizatio nNode",
System.Data.Ole Db.OleDbType.Va rWChar, 100, "OrganizationNo de"))
Me.OleDbUpdateC ommand1.Paramet ers.Add(New
System.Data.Ole Db.OleDbParamet er("Original_Or ganizationID",
System.Data.Ole Db.OleDbType.Gu id, 0, System.Data.Par ameterDirection .Input,
False, CType(0, Byte), CType(0, Byte), "OrganizationID ",
System.Data.Dat aRowVersion.Ori ginal, Nothing))
Me.OleDbUpdateC ommand1.Paramet ers.Add(New
System.Data.Ole Db.OleDbParamet er("Original_La stModifiedDate" ,
System.Data.Ole Db.OleDbType.DB Date, 0, System.Data.Par ameterDirection .Input,
False, CType(0, Byte), CType(0, Byte), "LastModifiedDa te",
System.Data.Dat aRowVersion.Ori ginal, Nothing))
Me.OleDbUpdateC ommand1.Paramet ers.Add(New
System.Data.Ole Db.OleDbParamet er("Original_La stModifiedUser" ,
System.Data.Ole Db.OleDbType.Va rWChar, 30,
System.Data.Par ameterDirection .Input, False, CType(0, Byte), CType(0, Byte),
"LastModifiedUs er", System.Data.Dat aRowVersion.Ori ginal, Nothing))
Me.OleDbUpdateC ommand1.Paramet ers.Add(New
System.Data.Ole Db.OleDbParamet er("Original_Or ganizationAbbrv ",
System.Data.Ole Db.OleDbType.Va rWChar, 10,
System.Data.Par ameterDirection .Input, False, CType(0, Byte), CType(0, Byte),
"OrganizationAb brv", System.Data.Dat aRowVersion.Ori ginal, Nothing))
Me.OleDbUpdateC ommand1.Paramet ers.Add(New
System.Data.Ole Db.OleDbParamet er("Original_Or ganizationAbbrv 1",
System.Data.Ole Db.OleDbType.Va rWChar, 10,
System.Data.Par ameterDirection .Input, False, CType(0, Byte), CType(0, Byte),
"OrganizationAb brv", System.Data.Dat aRowVersion.Ori ginal, Nothing))
Me.OleDbUpdateC ommand1.Paramet ers.Add(New
System.Data.Ole Db.OleDbParamet er("Original_Or ganizationAllow Delete",
System.Data.Ole Db.OleDbType.De cimal, 0,
System.Data.Par ameterDirection .Input, False, CType(1, Byte), CType(0, Byte),
"OrganizationAl lowDelete", System.Data.Dat aRowVersion.Ori ginal, Nothing))
Me.OleDbUpdateC ommand1.Paramet ers.Add(New
System.Data.Ole Db.OleDbParamet er("Original_Or ganizationIsRoo t",
System.Data.Ole Db.OleDbType.De cimal, 0,
System.Data.Par ameterDirection .Input, False, CType(1, Byte), CType(0, Byte),
"OrganizationIs Root", System.Data.Dat aRowVersion.Ori ginal, Nothing))
Me.OleDbUpdateC ommand1.Paramet ers.Add(New
System.Data.Ole Db.OleDbParamet er("Original_Or ganizationName" ,
System.Data.Ole Db.OleDbType.Va rWChar, 100,
System.Data.Par ameterDirection .Input, False, CType(0, Byte), CType(0, Byte),
"OrganizationNa me", System.Data.Dat aRowVersion.Ori ginal, Nothing))
Me.OleDbUpdateC ommand1.Paramet ers.Add(New
System.Data.Ole Db.OleDbParamet er("Original_Or ganizationNode" ,
System.Data.Ole Db.OleDbType.Va rWChar, 100,
System.Data.Par ameterDirection .Input, False, CType(0, Byte), CType(0, Byte),
"OrganizationNo de", System.Data.Dat aRowVersion.Ori ginal, Nothing))
'
'OrganizationAl lowDelete
'
Me.Organization AllowDelete.Dat aBindings.Add(N ew
System.Windows. Forms.Binding(" Checked", Me.OrgDataSet,
"Organizations. OrganizationAll owDelete"))
Me.Organization AllowDelete.Loc ation = New System.Drawing. Point(88,
56)
Me.Organization AllowDelete.Nam e = "OrganizationAl lowDelete"
Me.Organization AllowDelete.Siz e = New System.Drawing. Size(168, 24)
Me.Organization AllowDelete.Tab Index = 9
Me.Organization AllowDelete.Tex t = "OrganizationAl lowDelete"
'
'btnPrevious
'
Me.btnPrevious. Location = New System.Drawing. Point(16, 88)
Me.btnPrevious. Name = "btnPreviou s"
Me.btnPrevious. TabIndex = 11
Me.btnPrevious. Text = "Previous"
'
'btnNext
'
Me.btnNext.Loca tion = New System.Drawing. Point(128, 88)
Me.btnNext.Name = "btnNext"
Me.btnNext.TabI ndex = 12
Me.btnNext.Text = "Next"
'
'Form2
'
Me.AutoScaleBas eSize = New System.Drawing. Size(5, 13)
Me.ClientSize = New System.Drawing. Size(352, 117)
Me.Controls.Add (Me.btnNext)
Me.Controls.Add (Me.btnPrevious )
Me.Controls.Add (Me.Organizatio nAllowDelete)
Me.Controls.Add (Me.Organizatio nName)
Me.Controls.Add (Me.Organizatio nID)
Me.Controls.Add (Me.btnSave)
Me.Name = "Form2"
Me.Text = "Form1"
CType(Me.OrgDat aSet,
System.Componen tModel.ISupport Initialize).End Init()
Me.ResumeLayout (False)

End Sub

#End Region

Private Sub Form1_Load(ByVa l sender As Object, ByVal e As
System.EventArg s) Handles MyBase.Load
Me.OrgAdapter.F ill(Me.OrgDataS et)
End Sub

Private Sub btnNext_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles btnNext.Click
MoveRecord(1)
End Sub

Private Sub btnPrevious_Cli ck(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles btnPrevious.Cli ck
MoveRecord(-1)
End Sub
Private Sub MoveRecord(ByVa l Count As Integer)
Me.BindingConte xt(Me.OrgDataSe t, "Organizations" ).Position += Count
End Sub

Private Sub btnSave_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles btnSave.Click
Me.OrgAdapter.U pdate(Me.OrgDat aSet, "Organizations" )
End Sub
End Class

--------------------------------
From: Joe Fetters

-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)

<Id>txqPPDwRE0m Prb+Ji1A9Kg==</Id>
Nov 17 '05 #2
Don't mean to be rude, but why are you posting a VB.NET question on the C#
newsgroup?

There are at least 4 newsgroups that would be far more appropriate for your
question:

m.p.d.framework .windowsforms
m.p.d.framework .adonet
m.p.d.languages .vb
m.p.d.languages .vb.data

Pete

"Joe Fetters via .NET 247" <an*******@dotn et247.com> wrote in message
news:%2******** *******@TK2MSFT NGP12.phx.gbl.. .
Have googled and read the VS.NET documentation can't seem to get the answer
to the following.

Environment:
Framework 1.1
VB.NET WinForm
Access database
Using all automagic tools (DataAdapter Wizard with generated Dataset and
generated Select, Update, Insert and Delete commands, controls bound to
DataSet using the Advanced Databinding properties)

Issue:
Do I have to set parameters before I issue the DataSet.Update( Dataset,
[Table])? Again, my goal is minimal coding and let VS.NET generate
everything for me. I'm hoping there's an advance data property I need to
set on each control to bind it to the dataset. Currently the Text property
on the Textboxes is bound to the dataset and the Checked properties are set
on the CheckBoxes.

When I issue the command w/out setting any values it generates a "Additional
information: Concurrency violation: the UpdateCommand affected 0 records."
error.

Thanks for your time in advance,

Joe

VB.NET Code
*************** ****
Public Class Form2
Inherits System.Windows. Forms.Form

#Region " Windows Form Designer generated code "

Public Sub New()
MyBase.New()

'This call is required by the Windows Form Designer.
InitializeCompo nent()

'Add any initialization after the InitializeCompo nent() call

End Sub

'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Disp ose()
End If
End If
MyBase.Dispose( disposing)
End Sub

'Required by the Windows Form Designer
Private components As System.Componen tModel.IContain er

'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents OrgConnection As System.Data.Ole Db.OleDbConnect ion
Friend WithEvents OrganizationAll owDelete As
System.Windows. Forms.CheckBox
Friend WithEvents btnSave As System.Windows. Forms.Button
Friend WithEvents OrgAdapter As System.Data.Ole Db.OleDbDataAda pter
Friend WithEvents btnPrevious As System.Windows. Forms.Button
Friend WithEvents btnNext As System.Windows. Forms.Button
Friend WithEvents OrgDataSet As WindowsApplicat ion3.OrgDataSet
Friend WithEvents OrganizationID As System.Windows. Forms.TextBox
Friend WithEvents OrganizationNam e As System.Windows. Forms.TextBox
Friend WithEvents OleDbSelectComm and1 As System.Data.Ole Db.OleDbCommand
Friend WithEvents OleDbInsertComm and1 As System.Data.Ole Db.OleDbCommand
Friend WithEvents OleDbUpdateComm and1 As System.Data.Ole Db.OleDbCommand
Friend WithEvents OleDbDeleteComm and1 As System.Data.Ole Db.OleDbCommand
<System.Diagnos tics.DebuggerSt epThrough()> Private Sub
InitializeCompo nent()
Me.btnSave = New System.Windows. Forms.Button
Me.Organization ID = New System.Windows. Forms.TextBox
Me.OrgDataSet = New WindowsApplicat ion3.OrgDataSet
Me.Organization Name = New System.Windows. Forms.TextBox
Me.OrgConnectio n = New System.Data.Ole Db.OleDbConnect ion
Me.OrgAdapter = New System.Data.Ole Db.OleDbDataAda pter
Me.OleDbDeleteC ommand1 = New System.Data.Ole Db.OleDbCommand
Me.OleDbInsertC ommand1 = New System.Data.Ole Db.OleDbCommand
Me.OleDbSelectC ommand1 = New System.Data.Ole Db.OleDbCommand
Me.OleDbUpdateC ommand1 = New System.Data.Ole Db.OleDbCommand
Me.Organization AllowDelete = New System.Windows. Forms.CheckBox
Me.btnPrevious = New System.Windows. Forms.Button
Me.btnNext = New System.Windows. Forms.Button
CType(Me.OrgDat aSet,
System.Componen tModel.ISupport Initialize).Beg inInit()
Me.SuspendLayou t()
'
'btnSave
'
Me.btnSave.Loca tion = New System.Drawing. Point(256, 88)
Me.btnSave.Name = "btnSave"
Me.btnSave.TabI ndex = 0
Me.btnSave.Text = "Save"
'
'OrganizationID
'
Me.Organization ID.DataBindings .Add(New
System.Windows. Forms.Binding(" Text", Me.OrgDataSet,
"Organizations. OrganizationID" ))
Me.Organization ID.Location = New System.Drawing. Point(0, 8)
Me.Organization ID.Name = "OrganizationID "
Me.Organization ID.Size = New System.Drawing. Size(350, 20)
Me.Organization ID.TabIndex = 1
Me.Organization ID.Text = "OrganizationID "
'
'OrgDataSet
'
Me.OrgDataSet.D ataSetName = "OrgDataSet "
Me.OrgDataSet.L ocale = New System.Globaliz ation.CultureIn fo("en-US")
'
'OrganizationNa me
'
Me.Organization Name.DataBindin gs.Add(New
System.Windows. Forms.Binding(" Text", Me.OrgDataSet,
"Organizations. OrganizationNam e"))
Me.Organization Name.Location = New System.Drawing. Point(0, 32)
Me.Organization Name.Name = "OrganizationNa me"
Me.Organization Name.Size = New System.Drawing. Size(350, 20)
Me.Organization Name.TabIndex = 2
Me.Organization Name.Text = "OrganizationNa me"
'
'OrgConnection
'
Me.OrgConnectio n.ConnectionStr ing = "Jet OLEDB:Global Partial Bulk
Ops=2;Jet OLEDB:Registry Path=;Jet OLEDB:Database L" & _
"ocking Mode=1;Jet OLEDB:Database Password=;Data Source="{PathTo }\"
& _
"Your.mdb;Passw ord=;Jet OLEDB:Engine Type=5;Jet OLEDB:Globa" & _
"l Bulk Transactions=1; Provider=""Micr osoft.Jet.OLEDB .4.0"";Jet
OLEDB:System databa" & _
"se=;Jet OLEDB:SFP=False ;Extended Properties=;Mod e=Share Deny
None;Jet OLEDB:New " & _
"Database Password=;Jet OLEDB:Create System Database=False; Jet
OLEDB:Don't Copy L" & _
"ocale on Compact=False;J et OLEDB:Compact Without Replica
Repair=False;Us er ID=Ad" & _
"min;Jet OLEDB:Encrypt Database=False"
'
'OrgAdapter
'
Me.OrgAdapter.D eleteCommand = Me.OleDbDeleteC ommand1
Me.OrgAdapter.I nsertCommand = Me.OleDbInsertC ommand1
Me.OrgAdapter.M issingSchemaAct ion =
System.Data.Mis singSchemaActio n.AddWithKey
Me.OrgAdapter.S electCommand = Me.OleDbSelectC ommand1
Me.OrgAdapter.T ableMappings.Ad dRange(New
System.Data.Com mon.DataTableMa pping() {New
System.Data.Com mon.DataTableMa pping("Table", "Organizations" , New
System.Data.Com mon.DataColumnM apping() {New
System.Data.Com mon.DataColumnM apping("LastMod ifiedDate",
"LastModifiedDa te"), New
System.Data.Com mon.DataColumnM apping("LastMod ifiedUser",
"LastModifiedUs er"), New
System.Data.Com mon.DataColumnM apping("Organiz ationAbbrv",
"OrganizationAb brv"), New
System.Data.Com mon.DataColumnM apping("Organiz ationAllowDelet e",
"OrganizationAl lowDelete"), New
System.Data.Com mon.DataColumnM apping("Organiz ationDescriptio n",
"OrganizationDe scription"), New
System.Data.Com mon.DataColumnM apping("Organiz ationID", "OrganizationID "),
New System.Data.Com mon.DataColumnM apping("Organiz ationIsRoot",
"OrganizationIs Root"), New
System.Data.Com mon.DataColumnM apping("Organiz ationName",
"OrganizationNa me"), New
System.Data.Com mon.DataColumnM apping("Organiz ationNode",
"OrganizationNo de")})})
Me.OrgAdapter.U pdateCommand = Me.OleDbUpdateC ommand1
'
'OleDbDeleteCom mand1
'
Me.OleDbDeleteC ommand1.Command Text = "DELETE FROM Organizations
WHERE (OrganizationID = ?) AND (LastModifiedDa te = ?) A" & _
"ND (LastModifiedUs er = ?) AND (OrganizationAb brv = ? OR ? IS NULL
AND Organizati" & _
"onAbbrv IS NULL) AND (OrganizationAl lowDelete = ?) AND
(OrganizationIs Root = ?) " & _
"AND (OrganizationNa me = ?) AND (OrganizationNo de = ?)"
Me.OleDbDeleteC ommand1.Connect ion = Me.OrgConnectio n
Me.OleDbDeleteC ommand1.Paramet ers.Add(New
System.Data.Ole Db.OleDbParamet er("Original_Or ganizationID",
System.Data.Ole Db.OleDbType.Gu id, 0, System.Data.Par ameterDirection .Input,
False, CType(0, Byte), CType(0, Byte), "OrganizationID ",
System.Data.Dat aRowVersion.Ori ginal, Nothing))
Me.OleDbDeleteC ommand1.Paramet ers.Add(New
System.Data.Ole Db.OleDbParamet er("Original_La stModifiedDate" ,
System.Data.Ole Db.OleDbType.DB Date, 0, System.Data.Par ameterDirection .Input,
False, CType(0, Byte), CType(0, Byte), "LastModifiedDa te",
System.Data.Dat aRowVersion.Ori ginal, Nothing))
Me.OleDbDeleteC ommand1.Paramet ers.Add(New
System.Data.Ole Db.OleDbParamet er("Original_La stModifiedUser" ,
System.Data.Ole Db.OleDbType.Va rWChar, 30,
System.Data.Par ameterDirection .Input, False, CType(0, Byte), CType(0, Byte),
"LastModifiedUs er", System.Data.Dat aRowVersion.Ori ginal, Nothing))
Me.OleDbDeleteC ommand1.Paramet ers.Add(New
System.Data.Ole Db.OleDbParamet er("Original_Or ganizationAbbrv ",
System.Data.Ole Db.OleDbType.Va rWChar, 10,
System.Data.Par ameterDirection .Input, False, CType(0, Byte), CType(0, Byte),
"OrganizationAb brv", System.Data.Dat aRowVersion.Ori ginal, Nothing))
Me.OleDbDeleteC ommand1.Paramet ers.Add(New
System.Data.Ole Db.OleDbParamet er("Original_Or ganizationAbbrv 1",
System.Data.Ole Db.OleDbType.Va rWChar, 10,
System.Data.Par ameterDirection .Input, False, CType(0, Byte), CType(0, Byte),
"OrganizationAb brv", System.Data.Dat aRowVersion.Ori ginal, Nothing))
Me.OleDbDeleteC ommand1.Paramet ers.Add(New
System.Data.Ole Db.OleDbParamet er("Original_Or ganizationAllow Delete",
System.Data.Ole Db.OleDbType.De cimal, 0,
System.Data.Par ameterDirection .Input, False, CType(1, Byte), CType(0, Byte),
"OrganizationAl lowDelete", System.Data.Dat aRowVersion.Ori ginal, Nothing))
Me.OleDbDeleteC ommand1.Paramet ers.Add(New
System.Data.Ole Db.OleDbParamet er("Original_Or ganizationIsRoo t",
System.Data.Ole Db.OleDbType.De cimal, 0,
System.Data.Par ameterDirection .Input, False, CType(1, Byte), CType(0, Byte),
"OrganizationIs Root", System.Data.Dat aRowVersion.Ori ginal, Nothing))
Me.OleDbDeleteC ommand1.Paramet ers.Add(New
System.Data.Ole Db.OleDbParamet er("Original_Or ganizationName" ,
System.Data.Ole Db.OleDbType.Va rWChar, 100,
System.Data.Par ameterDirection .Input, False, CType(0, Byte), CType(0, Byte),
"OrganizationNa me", System.Data.Dat aRowVersion.Ori ginal, Nothing))
Me.OleDbDeleteC ommand1.Paramet ers.Add(New
System.Data.Ole Db.OleDbParamet er("Original_Or ganizationNode" ,
System.Data.Ole Db.OleDbType.Va rWChar, 100,
System.Data.Par ameterDirection .Input, False, CType(0, Byte), CType(0, Byte),
"OrganizationNo de", System.Data.Dat aRowVersion.Ori ginal, Nothing))
'
'OleDbInsertCom mand1
'
Me.OleDbInsertC ommand1.Command Text = "INSERT INTO
Organizations(L astModifiedDate , LastModifiedUse r, OrganizationAbb rv, " & _
"OrganizationAl lowDelete, OrganizationDes cription, OrganizationID,
OrganizationIs" & _
"Root, OrganizationNam e, OrganizationNod e) VALUES (?, ?, ?, ?, ?, ?,
?, ?, ?)"
Me.OleDbInsertC ommand1.Connect ion = Me.OrgConnectio n
Me.OleDbInsertC ommand1.Paramet ers.Add(New
System.Data.Ole Db.OleDbParamet er("LastModifie dDate",
System.Data.Ole Db.OleDbType.DB Date, 0, "LastModifiedDa te"))
Me.OleDbInsertC ommand1.Paramet ers.Add(New
System.Data.Ole Db.OleDbParamet er("LastModifie dUser",
System.Data.Ole Db.OleDbType.Va rWChar, 30, "LastModifiedUs er"))
Me.OleDbInsertC ommand1.Paramet ers.Add(New
System.Data.Ole Db.OleDbParamet er("Organizatio nAbbrv",
System.Data.Ole Db.OleDbType.Va rWChar, 10, "OrganizationAb brv"))
Me.OleDbInsertC ommand1.Paramet ers.Add(New
System.Data.Ole Db.OleDbParamet er("Organizatio nAllowDelete",
System.Data.Ole Db.OleDbType.De cimal, 0,
System.Data.Par ameterDirection .Input, False, CType(1, Byte), CType(0, Byte),
"OrganizationAl lowDelete", System.Data.Dat aRowVersion.Cur rent, Nothing))
Me.OleDbInsertC ommand1.Paramet ers.Add(New
System.Data.Ole Db.OleDbParamet er("Organizatio nDescription",
System.Data.Ole Db.OleDbType.Va rWChar, 0, "OrganizationDe scription"))
Me.OleDbInsertC ommand1.Paramet ers.Add(New
System.Data.Ole Db.OleDbParamet er("Organizatio nID",
System.Data.Ole Db.OleDbType.Gu id, 0, "OrganizationID "))
Me.OleDbInsertC ommand1.Paramet ers.Add(New
System.Data.Ole Db.OleDbParamet er("Organizatio nIsRoot",
System.Data.Ole Db.OleDbType.De cimal, 0,
System.Data.Par ameterDirection .Input, False, CType(1, Byte), CType(0, Byte),
"OrganizationIs Root", System.Data.Dat aRowVersion.Cur rent, Nothing))
Me.OleDbInsertC ommand1.Paramet ers.Add(New
System.Data.Ole Db.OleDbParamet er("Organizatio nName",
System.Data.Ole Db.OleDbType.Va rWChar, 100, "OrganizationNa me"))
Me.OleDbInsertC ommand1.Paramet ers.Add(New
System.Data.Ole Db.OleDbParamet er("Organizatio nNode",
System.Data.Ole Db.OleDbType.Va rWChar, 100, "OrganizationNo de"))
'
'OleDbSelectCom mand1
'
Me.OleDbSelectC ommand1.Command Text = "SELECT LastModifiedDat e,
LastModifiedUse r, OrganizationAbb rv, OrganizationAll owDe" & _
"lete, OrganizationDes cription, OrganizationID, OrganizationIsR oot,
OrganizationN" & _
"ame, OrganizationNod e FROM Organizations"
Me.OleDbSelectC ommand1.Connect ion = Me.OrgConnectio n
'
'OleDbUpdateCom mand1
'
Me.OleDbUpdateC ommand1.Command Text = "UPDATE Organizations SET
LastModifiedDat e = ?, LastModifiedUse r = ?, Organization" & _
"Abbrv = ?, OrganizationAll owDelete = ?, OrganizationDes cription =
?, Organizatio" & _
"nID = ?, OrganizationIsR oot = ?, OrganizationNam e = ?,
OrganizationNod e = ? WHER" & _
"E (OrganizationID = ?) AND (LastModifiedDa te = ?) AND
(LastModifiedUs er = ?) AND" & _
" (OrganizationAb brv = ? OR ? IS NULL AND OrganizationAbb rv IS NULL)
AND (Organiz" & _
"ationAllowDele te = ?) AND (OrganizationIs Root = ?) AND
(OrganizationNa me = ?) AN" & _
"D (OrganizationNo de = ?)"
Me.OleDbUpdateC ommand1.Connect ion = Me.OrgConnectio n
Me.OleDbUpdateC ommand1.Paramet ers.Add(New
System.Data.Ole Db.OleDbParamet er("LastModifie dDate",
System.Data.Ole Db.OleDbType.DB Date, 0, "LastModifiedDa te"))
Me.OleDbUpdateC ommand1.Paramet ers.Add(New
System.Data.Ole Db.OleDbParamet er("LastModifie dUser",
System.Data.Ole Db.OleDbType.Va rWChar, 30, "LastModifiedUs er"))
Me.OleDbUpdateC ommand1.Paramet ers.Add(New
System.Data.Ole Db.OleDbParamet er("Organizatio nAbbrv",
System.Data.Ole Db.OleDbType.Va rWChar, 10, "OrganizationAb brv"))
Me.OleDbUpdateC ommand1.Paramet ers.Add(New
System.Data.Ole Db.OleDbParamet er("Organizatio nAllowDelete",
System.Data.Ole Db.OleDbType.De cimal, 0,
System.Data.Par ameterDirection .Input, False, CType(1, Byte), CType(0, Byte),
"OrganizationAl lowDelete", System.Data.Dat aRowVersion.Cur rent, Nothing))
Me.OleDbUpdateC ommand1.Paramet ers.Add(New
System.Data.Ole Db.OleDbParamet er("Organizatio nDescription",
System.Data.Ole Db.OleDbType.Va rWChar, 0, "OrganizationDe scription"))
Me.OleDbUpdateC ommand1.Paramet ers.Add(New
System.Data.Ole Db.OleDbParamet er("Organizatio nID",
System.Data.Ole Db.OleDbType.Gu id, 0, "OrganizationID "))
Me.OleDbUpdateC ommand1.Paramet ers.Add(New
System.Data.Ole Db.OleDbParamet er("Organizatio nIsRoot",
System.Data.Ole Db.OleDbType.De cimal, 0,
System.Data.Par ameterDirection .Input, False, CType(1, Byte), CType(0, Byte),
"OrganizationIs Root", System.Data.Dat aRowVersion.Cur rent, Nothing))
Me.OleDbUpdateC ommand1.Paramet ers.Add(New
System.Data.Ole Db.OleDbParamet er("Organizatio nName",
System.Data.Ole Db.OleDbType.Va rWChar, 100, "OrganizationNa me"))
Me.OleDbUpdateC ommand1.Paramet ers.Add(New
System.Data.Ole Db.OleDbParamet er("Organizatio nNode",
System.Data.Ole Db.OleDbType.Va rWChar, 100, "OrganizationNo de"))
Me.OleDbUpdateC ommand1.Paramet ers.Add(New
System.Data.Ole Db.OleDbParamet er("Original_Or ganizationID",
System.Data.Ole Db.OleDbType.Gu id, 0, System.Data.Par ameterDirection .Input,
False, CType(0, Byte), CType(0, Byte), "OrganizationID ",
System.Data.Dat aRowVersion.Ori ginal, Nothing))
Me.OleDbUpdateC ommand1.Paramet ers.Add(New
System.Data.Ole Db.OleDbParamet er("Original_La stModifiedDate" ,
System.Data.Ole Db.OleDbType.DB Date, 0, System.Data.Par ameterDirection .Input,
False, CType(0, Byte), CType(0, Byte), "LastModifiedDa te",
System.Data.Dat aRowVersion.Ori ginal, Nothing))
Me.OleDbUpdateC ommand1.Paramet ers.Add(New
System.Data.Ole Db.OleDbParamet er("Original_La stModifiedUser" ,
System.Data.Ole Db.OleDbType.Va rWChar, 30,
System.Data.Par ameterDirection .Input, False, CType(0, Byte), CType(0, Byte),
"LastModifiedUs er", System.Data.Dat aRowVersion.Ori ginal, Nothing))
Me.OleDbUpdateC ommand1.Paramet ers.Add(New
System.Data.Ole Db.OleDbParamet er("Original_Or ganizationAbbrv ",
System.Data.Ole Db.OleDbType.Va rWChar, 10,
System.Data.Par ameterDirection .Input, False, CType(0, Byte), CType(0, Byte),
"OrganizationAb brv", System.Data.Dat aRowVersion.Ori ginal, Nothing))
Me.OleDbUpdateC ommand1.Paramet ers.Add(New
System.Data.Ole Db.OleDbParamet er("Original_Or ganizationAbbrv 1",
System.Data.Ole Db.OleDbType.Va rWChar, 10,
System.Data.Par ameterDirection .Input, False, CType(0, Byte), CType(0, Byte),
"OrganizationAb brv", System.Data.Dat aRowVersion.Ori ginal, Nothing))
Me.OleDbUpdateC ommand1.Paramet ers.Add(New
System.Data.Ole Db.OleDbParamet er("Original_Or ganizationAllow Delete",
System.Data.Ole Db.OleDbType.De cimal, 0,
System.Data.Par ameterDirection .Input, False, CType(1, Byte), CType(0, Byte),
"OrganizationAl lowDelete", System.Data.Dat aRowVersion.Ori ginal, Nothing))
Me.OleDbUpdateC ommand1.Paramet ers.Add(New
System.Data.Ole Db.OleDbParamet er("Original_Or ganizationIsRoo t",
System.Data.Ole Db.OleDbType.De cimal, 0,
System.Data.Par ameterDirection .Input, False, CType(1, Byte), CType(0, Byte),
"OrganizationIs Root", System.Data.Dat aRowVersion.Ori ginal, Nothing))
Me.OleDbUpdateC ommand1.Paramet ers.Add(New
System.Data.Ole Db.OleDbParamet er("Original_Or ganizationName" ,
System.Data.Ole Db.OleDbType.Va rWChar, 100,
System.Data.Par ameterDirection .Input, False, CType(0, Byte), CType(0, Byte),
"OrganizationNa me", System.Data.Dat aRowVersion.Ori ginal, Nothing))
Me.OleDbUpdateC ommand1.Paramet ers.Add(New
System.Data.Ole Db.OleDbParamet er("Original_Or ganizationNode" ,
System.Data.Ole Db.OleDbType.Va rWChar, 100,
System.Data.Par ameterDirection .Input, False, CType(0, Byte), CType(0, Byte),
"OrganizationNo de", System.Data.Dat aRowVersion.Ori ginal, Nothing))
'
'OrganizationAl lowDelete
'
Me.Organization AllowDelete.Dat aBindings.Add(N ew
System.Windows. Forms.Binding(" Checked", Me.OrgDataSet,
"Organizations. OrganizationAll owDelete"))
Me.Organization AllowDelete.Loc ation = New System.Drawing. Point(88,
56)
Me.Organization AllowDelete.Nam e = "OrganizationAl lowDelete"
Me.Organization AllowDelete.Siz e = New System.Drawing. Size(168, 24)
Me.Organization AllowDelete.Tab Index = 9
Me.Organization AllowDelete.Tex t = "OrganizationAl lowDelete"
'
'btnPrevious
'
Me.btnPrevious. Location = New System.Drawing. Point(16, 88)
Me.btnPrevious. Name = "btnPreviou s"
Me.btnPrevious. TabIndex = 11
Me.btnPrevious. Text = "Previous"
'
'btnNext
'
Me.btnNext.Loca tion = New System.Drawing. Point(128, 88)
Me.btnNext.Name = "btnNext"
Me.btnNext.TabI ndex = 12
Me.btnNext.Text = "Next"
'
'Form2
'
Me.AutoScaleBas eSize = New System.Drawing. Size(5, 13)
Me.ClientSize = New System.Drawing. Size(352, 117)
Me.Controls.Add (Me.btnNext)
Me.Controls.Add (Me.btnPrevious )
Me.Controls.Add (Me.Organizatio nAllowDelete)
Me.Controls.Add (Me.Organizatio nName)
Me.Controls.Add (Me.Organizatio nID)
Me.Controls.Add (Me.btnSave)
Me.Name = "Form2"
Me.Text = "Form1"
CType(Me.OrgDat aSet,
System.Componen tModel.ISupport Initialize).End Init()
Me.ResumeLayout (False)

End Sub

#End Region

Private Sub Form1_Load(ByVa l sender As Object, ByVal e As
System.EventArg s) Handles MyBase.Load
Me.OrgAdapter.F ill(Me.OrgDataS et)
End Sub

Private Sub btnNext_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles btnNext.Click
MoveRecord(1)
End Sub

Private Sub btnPrevious_Cli ck(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles btnPrevious.Cli ck
MoveRecord(-1)
End Sub
Private Sub MoveRecord(ByVa l Count As Integer)
Me.BindingConte xt(Me.OrgDataSe t, "Organizations" ).Position += Count
End Sub

Private Sub btnSave_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles btnSave.Click
Me.OrgAdapter.U pdate(Me.OrgDat aSet, "Organizations" )
End Sub
End Class

--------------------------------
From: Joe Fetters

-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)

<Id>txqPPDwRE0m Prb+Ji1A9Kg==</Id>
Nov 17 '05 #3

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

Similar topics

5
2259
by: randy | last post by:
Hello all, I have a DataTable which I am building column by column and adding rows after each new column. The DataTable columns match the columns in my database table. I'm building the DataTable first and I then want to roll through the DataTable while in memory checking for errors and then commit the rows to my database table (btw this is in ASP.NET). Is it possible to have data in a datable before attaching at DataAdapter? I'm a...
2
4280
by: hch | last post by:
dataAdapter.Update(data, "TableName") won’t work! I was about to deploy my first website on the Internet only to discover that the dataAdapter.Update() throws the Server Error in the third underline. It was working fine before. ConnectionString in Web.config: ----------------------------------------- <?xml version="1.0" encoding="utf-8" ?> <configuration>
6
1583
by: Geoff Pennington | last post by:
I have a class method that returns a DataAdapter. I want to access the table(s) contained in the DataAdapter. Of course, accessing the DataSets would be good enough, because I could get the tables from there. I can't find a way to do this. Am I missing something? Much obliged.
13
2095
by: Doug Bell | last post by:
Hi, I thought I had this sorted this morning but it is still a problem. My application has a DataAccess Class. When it starts, it: Connects to a DB (OLE DB) If it connects it uses an OleDbCommand with an SQL String and the connection it has a DataAdapter with the command then it fills the DataSet's DataTable with the streamed data.
11
2259
by: Siv | last post by:
Hi, I seem to be having a problem with a DataAdapter against an Access database. My app deletes 3 records runs a da.update(dt) where dt is a data.Datatable. I then proceed to update a list to reflect that the 3 items have been deleted only to discover that the 3 items appear, however when I click on them to display their information which runs a datareader over the same database it appears that the data has now gone. I wondered whether...
8
2703
by: Zorpiedoman | last post by:
I keep getting a concurrency exception the second time I make a change and attempt to update a dataadapter. It appears this is by design, so there must be something I can do to avoid it. Example: I have a dataadapter that contains one table with one row. I change the value of the 'FisrtName' column in that row from Jack to John. I call ..update on the dataadapter it goes through fine. Now I change that same column in that same row...
7
1811
by: Max | last post by:
I've included the needed tables in the DataSource. Those tables that are bound to controls I can workwith. But how do you get access to the DataAdaptors that are not bound? me.Dataset1.table is a table with no Insert or Update methods. pll.DataSet1.table has the Row, ChangeEvent, and ChangeEventHandler. It seems like it should be fairly straight forward to use the DataAdapter without binding it to a control. How do you do this?
2
1896
by: Franklin M. Gauer III | last post by:
I create a simple DATAADAPTER in a webservice project. It creates the UPDATE, INSERT, DELETE commands for me - no problem. In vS2005 it creates these commands as RESOURCES in the RESX file (i.e. strings). The problem is whenever I try to test the webservice I get: System.Resources.MissingManifestResourceException: Could not find any resources appropriate for the specified culture or the neutral culture. Make sure...
6
14007
by: Rich | last post by:
Dim da As New SqlDataAdapter("Select * from tbl1", conn) dim tblx As New DataTable da.Fill(tblx) '--works OK up to this point da.UpdateCommand = New SqlCommand da.UpdateCommand.Connection = conn da.UpdateCommand.CommandText = "Update tbl1 set fld1 = 'test' where ID = 1" da.Update(tblx) '--tblx/tbl1 not getting updated here.
3
12526
by: Rich | last post by:
What is the diffeence bewtween a dataAdapter.InsertCommand and dataAdapter.SelectCommand (and dataAdapter.UpdateCommand for that matter)? Dim da As SqlDataAdapter conn.Open da.SelectCommand = New SqlCommand da.SelectCommand.Connectoin = conn da.SelectCommand.CommandType = Command.Text da.SelectCommand.CommandText = "insert Into tbl1 Select * from tbl2" da.SelectCommand.ExecuteNonQuery
0
9682
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10875
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10566
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10623
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7806
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7001
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5669
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4474
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4040
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.