Ver Mensaje Individual
  #1 (permalink)  
Antiguo 17/10/2011, 11:09
rvillanueva
 
Fecha de Ingreso: diciembre-2005
Mensajes: 28
Antigüedad: 18 años, 5 meses
Puntos: 0
The DataAdapter.SelectCommand property needs to be initialized.

Buenos dias, estoy empezando a aprendr VB con BD, usando VS2010 Y Access 2010.

Tengo este error y no se donde esta ??, Mi codigo :

Public Class Form2
Dim dbProvider As String
Dim dbSource As String
Dim con As New OleDb.OleDbConnection

Dim DSet As New DataSet
Dim DAdapter As New OleDb.OleDbDataAdapter
Dim dsNewRow As DataRow
Dim cb As New OleDb.OleDbCommandBuilder(DAdapter)

Private Sub OpenDB()
dbProvider = "PROVIDER=Microsoft.ACE.OleDb.12.0;"
dbSource = "Data Source = D:\My Documents\DataBases\In-Tech.accdb"

con.ConnectionString = dbProvider & dbSource
con.Open()
End Sub

Private Sub NewRecord()
Me.ClientesTableAdapter.Fill(Me.DataSet.Clientes)
IDTextBox.Text = Me.ClientesBindingSource.Count + 1
RAZON_SOCIALTextBox.Clear()
NOMBRETextBox.Clear()
RFCTextBox.Clear()
End Sub

Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
OpenDB()
'TODO: This line of code loads data into the 'DataSet.Plazo' table. You can move, or remove it, as needed.
Me.PlazoTableAdapter.Fill(Me.DataSet.Plazo)
'TODO: This line of code loads data into the 'DataSet.Clientes' table. You can move, or remove it, as needed.
NewRecord()
End Sub

Private Sub SaveRec_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles SaveRec.Click
dsNewRow = DSet.Tables("Clientes").NewRow()
With dsNewRow
.Item("Id") = IDTextBox.Text
.Item("RAZON SOCIAL") = RAZON_SOCIALTextBox.Text
.Item("NOMBRE") = NOMBRETextBox.Text
.Item("RFC") = RFCTextBox.Text
End With
DSet.Tables("Clientes").Rows.Add(dsNewRow)
DAdapter.Update(DSet, "Clientes")

En esta linea es donde me marca !!


End Sub
End Class

Alguien sabra porque ?, me falta algo ?

Saludos