I
Ivan Weiss
Another question for the whizzes out there. I have the following code
in a database class:
Public Sub insertData(ByVal argInsertSql As String, ByVal argTable As
String)
Dim myConnection As New OleDbConnection(dbConnString)
Dim strSelectSql As String = "SELECT * FROM " & argTable
Dim myDataAdapter As New OleDbDataAdapter(strSelectSql,
myConnection)
Dim myDataSet As New DataSet()
Dim myDataTable As DataTable()
Dim myDataRow As DataRow()
Try
myConnection.Open()
myDataAdapter.Fill(myDataSet, argTable)
myDataTable = myDataSet.Tables(argTable)
myDataRow = myDataTable.newrow
Catch
DisplayErrorMessage("clsDatabase:insertData")
End Try
End Sub
The myDataTable = myDataSet.Tables(argTable) AND
the myDataRow = myDataTable.newrow
are both generating errors. Saying cant convert data table to
1-dimensional array of type datatable. I am trying to learn how to
update a database via ADO.Net directly from an online book I have and
there example isn't working.
What am I doing wrong?
-Ivan
in a database class:
Public Sub insertData(ByVal argInsertSql As String, ByVal argTable As
String)
Dim myConnection As New OleDbConnection(dbConnString)
Dim strSelectSql As String = "SELECT * FROM " & argTable
Dim myDataAdapter As New OleDbDataAdapter(strSelectSql,
myConnection)
Dim myDataSet As New DataSet()
Dim myDataTable As DataTable()
Dim myDataRow As DataRow()
Try
myConnection.Open()
myDataAdapter.Fill(myDataSet, argTable)
myDataTable = myDataSet.Tables(argTable)
myDataRow = myDataTable.newrow
Catch
DisplayErrorMessage("clsDatabase:insertData")
End Try
End Sub
The myDataTable = myDataSet.Tables(argTable) AND
the myDataRow = myDataTable.newrow
are both generating errors. Saying cant convert data table to
1-dimensional array of type datatable. I am trying to learn how to
update a database via ADO.Net directly from an online book I have and
there example isn't working.
What am I doing wrong?
-Ivan