Alguien ayudeme
Publicado por Arena Sharloth (30 intervenciones) el 26/02/2008 14:57:45
Hola amigos estoy desarrollando un aplicacion con clases y tengo un problema, no puedo asignar las propiedades de la clase a los campos del formulario, no se si me explico pero alguien orienteme al respecto
Aqui presento una parte del codigo que estoy utilizando
Public Property ID_Partida() As Integer
Get
Return P_ID_Partida
End Get
Set(ByVal Value As Integer)
P_ID_Partida = Value
End Set
End Property
Public Property Tomo() As Integer
Get
Return P_Tomo
End Get
Set(ByVal Value As Integer)
P_Tomo = Value
End Set
End Property
Public Sub AbrirBD()
Try
Me.oConexion = New SqlConnection
oConexion.ConnectionString = conexion
Me.oDataAdapter = New SqlDataAdapter _
("Select * From CERTIFICADO_NACIMIENTO ", oConexion)
Me.oDataSet = New DataSet
Me.oDataSet.Clear()
Dim CmdBuilder As New SqlCommandBuilder(Me.oDataAdapter)
oConexion.Open()
Me.oDataAdapter.Fill(Me.oDataSet, "CERTIFICADO_NACIMIENTO")
oConexion.Close()
CargarDatos()
Me.iPosicionActual = 0
Catch ex As Exception
MessageBox.Show("Ha ocurrido el sguiente error: " & ex.Message.ToString, _
"Error....", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub
Public Sub CargarDatos()
Try
Dim oDataRow As DataRow
oDataRow = Me.oDataSet.Tables("CERTIFICADO_NACIMIENTO").Rows(Me.iPosicionActual)
FrmNacimientos.txtIdRegistro.Text = oDataRow("Id_Partida").ToString
FrmNacimientos.txtTomo.Text = oDataRow("Tomo").ToString
Catch ex As Exception
MessageBox.Show("Ha ocurrido el siguiente error: " & ex.Message.ToString, "Error...", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End sub
Ahora como asigno las propiedades de la clase a la bd
Tengo un ejemplo pero me da un error aqui se los muestro:
oDataAdapter.InsertCommand.Parameters("@TOMO").Value = Me.Tomo
Aqui presento una parte del codigo que estoy utilizando
Public Property ID_Partida() As Integer
Get
Return P_ID_Partida
End Get
Set(ByVal Value As Integer)
P_ID_Partida = Value
End Set
End Property
Public Property Tomo() As Integer
Get
Return P_Tomo
End Get
Set(ByVal Value As Integer)
P_Tomo = Value
End Set
End Property
Public Sub AbrirBD()
Try
Me.oConexion = New SqlConnection
oConexion.ConnectionString = conexion
Me.oDataAdapter = New SqlDataAdapter _
("Select * From CERTIFICADO_NACIMIENTO ", oConexion)
Me.oDataSet = New DataSet
Me.oDataSet.Clear()
Dim CmdBuilder As New SqlCommandBuilder(Me.oDataAdapter)
oConexion.Open()
Me.oDataAdapter.Fill(Me.oDataSet, "CERTIFICADO_NACIMIENTO")
oConexion.Close()
CargarDatos()
Me.iPosicionActual = 0
Catch ex As Exception
MessageBox.Show("Ha ocurrido el sguiente error: " & ex.Message.ToString, _
"Error....", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub
Public Sub CargarDatos()
Try
Dim oDataRow As DataRow
oDataRow = Me.oDataSet.Tables("CERTIFICADO_NACIMIENTO").Rows(Me.iPosicionActual)
FrmNacimientos.txtIdRegistro.Text = oDataRow("Id_Partida").ToString
FrmNacimientos.txtTomo.Text = oDataRow("Tomo").ToString
Catch ex As Exception
MessageBox.Show("Ha ocurrido el siguiente error: " & ex.Message.ToString, "Error...", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End sub
Ahora como asigno las propiedades de la clase a la bd
Tengo un ejemplo pero me da un error aqui se los muestro:
oDataAdapter.InsertCommand.Parameters("@TOMO").Value = Me.Tomo
Valora esta pregunta


0