|    
			
				09/03/2012, 13:39
			
			
			  | 
  |   |  |  |  Fecha de Ingreso: marzo-2012 
						Mensajes: 11
					 Antigüedad: 13 años, 7 meses Puntos: 0 |  | 
  |  Respuesta: Actualizar Base de Datos con Archivo Excel  
  Que tal Emmax me salio error pero no se porque te copio como puse el codigo para que si ves un error me ayudes a corregirlo gracias por tu aportacion
 
 Saludos
 
 Using objOleConnection = New OleDbConnection( _
 "Provider=PervasiveOLEDB;Data Source=PFWENTARI;Location=10.27.17.33;")
 End Using
 
 Dim update_string As String
 Dim Itemkey As String
 Dim Locationkey As String = ""
 Dim Forecastkey As String = ""
 Dim Forecastdate As String = ""
 Dim Forecastqty As String = ""
 Dim Recdate As String = ""
 Dim Rectime As String = ""
 Dim Recuserid As String = ""
 
 With frmCargaDG.DGE1
 Try
 For i As Integer = 0 To frmCargaDG.DGE1.Rows.Count - 2
 Itemkey = frmCargaDG.DGE1.Rows(i).Cells("Itemkey").Value.ToS  tring
 Locationkey = frmCargaDG.DGE1.Rows(i).Cells("Locationkey").Value  .ToString
 Forecastkey = frmCargaDG.DGE1.Rows(i).Cells("Forescastkey").Valu  e.ToString
 Forecastdate = frmCargaDG.DGE1.Rows(i).Cells("Forecastdate").Valu  e.ToString
 Forecastqty = frmCargaDG.DGE1.Rows(i).Cells("Forecastqty").Value  .ToString
 Recuserid = frmCargaDG.DGE1.Rows(i).Cells("Recuserid").Value.T  oString
 Rectime = frmCargaDG.DGE1.Rows(i).Cells("Rectime").Value.ToS  tring
 Recdate = frmCargaDG.DGE1.Rows(i).Cells("Recdate").Value.ToS  tring
 
 update_string = "INSERT INTO PLFRCSTD(Itemkey, Locationkey, Forecastkey, Forecastdate, Forecastqty, Recuserid, Recdate, Rectime)" & _
 "VALUES(@Itemkey, @Locationkey, @Forecastkey, @Forecastdate, @Forecastqty, @Recuserid, @Recdate, @Rectime)"
 
 cmdText = New OleDbCommand(update_string, objOleConnection)
 cmdText.Parameters.AddWithValue("@Itemkey", Itemkey)
 cmdText.Parameters.AddWithValue("@Locationkey", Locationkey)
 cmdText.Parameters.AddWithValue("@@Forecastkey", Forecastkey)
 cmdText.Parameters.AddWithValue("@@Forecastdate", Forecastdate)
 cmdText.Parameters.AddWithValue("@Forecastqty", Forecastqty)
 cmdText.Parameters.AddWithValue("@Recuserid", Recuserid)
 cmdText.Parameters.AddWithValue("@Recdate", Recdate)
 cmdText.Parameters.AddWithValue("@Rectime", Rectime)
 
 cmdText.ExecuteNonQuery()
 
 Next
 MsgBox("Base de Datos Actualizada", MsgBoxStyle.Information)
 frmCargaDG.DGE1.Rows.Clear()
 Catch
 MsgBox("Error al Actualizar", MsgBoxStyle.Critical)
 End Try
 End With
 
 Espero me puedas ayudar con este error gracias por tu ayuda :)
     |