Foros del Web » Programación para mayores de 30 ;) » Programación General »

problema con el data griew

Estas en el tema de problema con el data griew en el foro de Programación General en Foros del Web. hola tengo un problema con el data griew debido a que tengo un boton que es guardar datos pero no m aparece en el data ...
  #1 (permalink)  
Antiguo 07/12/2010, 10:41
 
Fecha de Ingreso: octubre-2010
Ubicación: coronel
Mensajes: 1
Antigüedad: 13 años, 6 meses
Puntos: 0
problema con el data griew

hola tengo un problema con el data griew debido a que tengo un boton que es guardar datos pero no m aparece en el data griew este es el codigo si alguien m puede ayudar porfavor
Public Class Form1


Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
InsertaRegistro(Me.txtdocumentos.Text, Me.Label5.Text, Me.txtdetalle.Text, Me.txtmonto.Text, Me.txtmontototal.Text)
End Sub
Public Sub InsertaRegistro(ByVal Nºdocumento As Integer, ByVal Fecha As Date, ByVal Detalle As String, ByVal Monto As String, ByVal montoTotal As String)

Using con As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=I:\cotizacion1.mdb")
Dim cmd As New OleDbCommand("Insert into Ingreso(NºDocumento,Fecha,Detalle,Monto,Monto_Tota l) values(@NºDocumento,@Fecha,@Detalle,@Monto,@Monto_ Total)", con)
con.Open()
Try
cmd.Parameters.AddWithValue("@NºDocumento", Nºdocumento)
cmd.Parameters.AddWithValue("@Fecha", Fecha)
cmd.Parameters.AddWithValue("@Detalle", Detalle)
cmd.Parameters.AddWithValue("@Monto", Monto)
cmd.Parameters.AddWithValue("@monto_Total", montoTotal)
cmd.ExecuteNonQuery() ' ESTA EL Meotodo que te inserta a la base de datos
For Each row As DataGridViewRow In Me.DataGridView1.Rows
row.Cells("Nºdocumento").Value = txtdocumentos.Text
row.Cells("fecha").Value = Label5.Text
row.Cells("detalle").Value = txtdetalle.Text
row.Cells("Monto").Value = txtmonto.Text
row.Cells("montototal").Value = txtmontototal.Text


Next

Catch ex As Exception
Dim ms As String = ex.Message
End Try
con.Close()
End Using
End Sub


Dim fechahoy As Date
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'TODO: esta línea de código carga datos en la tabla 'Cotizacion1DataSet.Ingreso' Puede moverla o quitarla según sea necesario.
fechahoy = Date.Today
Label5.Text = fechahoy
CargarGrilla()
txtdocumentos.Text = ""
txtdetalle.Text = ""
txtmonto.Text = ""
txtmontototal.Text = ""
End Sub

Private Sub CargarGrilla()

'Este codigo es pa llenar el datagridview ok
Using OleDbConnection As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=I:\cotizacion1.mdb")
Dim cmd As New OleDbCommand("select Nºdocumento, Fecha, Detalle, Monto,monto_Total From Ingreso", OleDbConnection)
Dim dt As New DataTable
Dim da As New OleDbDataAdapter(cmd)
Dim ds As New DataSet()

Try
da.Fill(dt)
Me.DataGridView1.DataSource = dt

Catch ex As Exception
MsgBox(ex.Message)
End Try

End Using

End Sub

Etiquetas: data
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 17:35.