Re: getting error on record duplication
- From: Co <vonclausowitz@xxxxxxxxx>
- Date: Fri, 29 May 2009 02:19:02 -0700 (PDT)
On 29 mei, 09:57, "Cor Ligthert[MVP]" <Notmyfirstn...@xxxxxxxxx>
wrote:
Hi Co,
Helping you is no problem, but you can make it more easy for us.
It is not needed for us to see your complete program. As it is the time for
that you will be asked for sure.
Give us the relevant parts, then helping you is much easier and more
effective
Something in general about programming, do all data names in English or do
them in Dutch, now it looks so amateuristic.
There is an advance for using Dutch names, but I find it awful reading so I
don't do that.
What is the reason you do it bottom up, that should be done when you are
deleting?
Cor
"Co" <vonclausow...@xxxxxxxxx> wrote in message
news:9b65bbb1-7b1e-423e-bdf1-fe3012b4dc45@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hi All,
I have following code to duplicate records in a database table:
When I duplicate one record everything works but when I try to add
more records I get this error:
"Conversion from type dbnull to type string is not valid."
The code stops at the lien saying:
dr = ds.Tables(0).Rows(j)
Sub FileDuplicator(ByVal oldNode As Integer, ByVal newNode As Integer,
ByVal fileID() As String)
Dim sql As String = "SELECT * FROM Bestanden WHERE Lokatie=" &
oldNode
Dim strTable As String = "Bestanden"
Dim da As New OleDb.OleDbDataAdapter(sql, conn)
Dim cb As New OleDb.OleDbCommandBuilder(da)
Dim ds As New DataSet
Dim i As Integer
Dim newRow As DataRow
Try
da.SelectCommand = New OleDb.OleDbCommand(sql, conn)
da.Fill(ds, strTable)
Dim dr As DataRow
For i = 0 To fileID.Length - 1
For j As Integer = ds.Tables(0).Rows.Count - 1 To 0
Step -1
dr = ds.Tables(0).Rows(j)
'For Each dr In ds.Tables(0).Rows
If CStr(dr.Item("Id")) = fileID(i) Then
'create this file in the folder
newRow = ds.Tables(strTable).NewRow()
newRow("filenaam") = dr.Item("filenaam")
newRow("status") = FixNull(dr.Item("status"))
newRow("lokatie") = newNode
newRow("extensie") = dr.Item("extensie")
newRow("grootte") = FixNull(dr.Item
("grootte"))
newRow("datum_gemaakt") = FixNull(dr.Item
("datum_gemaakt"))
newRow("datum_gewijzigd") = FixNull(dr.Item
("datum_gewijzigd"))
newRow("expires") = FixNull(dr.Item
("expires"))
newRow("hddlokatie") = FixNull(dr.Item
("hddlokatie"))
newRow("samenvatting") = dr.Item
("samenvatting")
newRow("kenmerk") = FixNull(dr.Item
("kenmerk"))
newRow("auteur") = FixNull(dr.Item("auteur"))
newRow("soort") = FixNull(dr.Item("soort"))
newRow("inuit") = FixNull(dr.Item("inuit"))
ds.Tables(strTable).Rows..Add(newRow)
End If
Next
Next
'sent the updated dataSet to the database
da.Update(ds, strTable)
Catch oException As OleDbException
MessageBox.Show(oException.Message)
Catch oException As Exception
MessageBox.Show(oException.Message)
End Try
conn.Close()
End Sub
Any thoughts?
Regards
Marco
You are right I should do them in English.
Is there a difference in going bottom up?
Marco
.
- Follow-Ups:
- Re: getting error on record duplication
- From: Cor Ligthert[MVP]
- Re: getting error on record duplication
- References:
- getting error on record duplication
- From: Co
- Re: getting error on record duplication
- From: Cor Ligthert[MVP]
- getting error on record duplication
- Prev by Date: Re: getting error on record duplication
- Next by Date: Re: getting error on record duplication
- Previous by thread: Re: getting error on record duplication
- Next by thread: Re: getting error on record duplication
- Index(es):
Relevant Pages
|