sale un error que se muestra en diferentes partes
Publicado por Miguel (281 intervenciones) el 07/01/2014 17:54:32
Puede alguien ayudarme a detectar este fallo en este código
Gracias y un saludo
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
Option Explicit On
Imports System.Data.OleDb
Public Class clsInsertaReg
Private da As OleDbDataAdapter
Private ds As DataSet
Public Function AñadeReg(ByVal cn As OleDbConnection, ByVal Tabla As String, ByVal valores() As String) As Boolean
Dim Param As Long
Dim I As Integer
Dim dr As DataRow
Try
Param = UBound(valores) - 1
dr = ds.Tables(Tabla).NewRow ' en esta linea da el error
For I = 0 To Param
dr(I) = valores(I)
Next
ds.Tables(Tabla).Rows.Add(dr)
da.Update(ds, Tabla)
AñadeReg = True
Catch ex As OleDb.OleDbException
AñadeReg = False
Finally
If cn IsNot Nothing AndAlso cn.State <> ConnectionState.Closed Then
cn.Close()
End If
End Try
End Function
End Class
Gracias y un saludo
Valora esta pregunta


0