Visual Basic - Como agregar datos a un datagridview

Life is soft - evento anual de software empresarial
 
Vista:

Como agregar datos a un datagridview

Publicado por Carlos (50 intervenciones) el 15/09/2009 17:40:23
Hola a todos

Este problema me tiene ya bastante tiempo
Con esto cargo los datos a una tabla access

Primero declaro esto
Private MiAdaptadorMat As New OleDbDataAdapter("SELECT * FROM precios WHERE COS_MATMDO = 'MAT' ORDER BY COS_DESCR", MiConexion)
Private MiDataSetMat As New DataSet()
Private MiEnlazadorMat As New BindingSource

luego en el form_load cargo mi datagridview asi
Me.GridMateriales.DataSource = MiDataSetMat.Tables(0)

Luego en el boton agregar....

With MiAdaptadorMat
.InsertCommand = New System.Data.OleDb.OleDbCommand
.InsertCommand.Connection = MiConexion
.InsertCommand.CommandText = "INSERT INTO Precios(COS_DESCR,COS_COSTO) VALUES (@material,@costo)"
.InsertCommand.CommandType = System.Data.CommandType.Text
.InsertCommand.Parameters.Add("@material", OleDbType.VarChar).Value = txtMaterialesNuevoMat.Text
.InsertCommand.Parameters.Add("@costo", OleDbType.VarChar).Value = txtCostoEditMat.Text

End With

pero no se como agregar esos datos al datagrid.

Alguien podria darme una ayuda por favor

Gracias

CArlos
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:Como agregar datos a un datagridview

Publicado por jaime guerrero (361 intervenciones) el 15/09/2009 18:18:45
porque la gente no entiende. pongan sus preguntas en los foros que corresponde. esto es ado calsico, no .net

para agregar registros a un datagridview solo haces

datagridview.datasource=xxxxxx
datagridviwe.databind

xxxxxx--> puede ser un dataset o un datatable
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar