anubis7000
Programmer
Hi,
I am attempting to populate or fill a typed dataset using the data from my back end ms access database.
I am using this website as a template:
I am stuck at the initilize data function, which is called in the page_load() function. The typed dataset, Dataset1, and the corresponding table, WorkExperianceData are connected to my access database.
Here is my code thus far:
Dim MyRs As New ADODB.Recordset()
Dim MyCn As New ADODB.Connection()
MyCn.Open("Provider=Microsoft.jet.oledb.4.0;data source=d:\workdata.mdb")
MyRs.Open("Select * from WorkExperianceData", MyCn, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockOptimistic)
'Create and fill the DataSet from the Recordset. Populate the grid from the DataSet.
Dim myDA As OleDbDataAdapter = New OleDbDataAdapter()
myDA.Fill(DataSet1.WorkExperianceDataDataTable, MyRs, "WorkExperianceData")
DataGrid1.DataSource = DataSet1.Tables(0)
MyRs = Nothing
MyCn.Close()
MyCn = Nothing
Specifically, I am getting errors at the "myDA.Fill...." and the subsequent "DataGrid.Datasource = ..." line, as the compiler says that the use of DataSet is an invalid declaration.
Thanks in advance.
I am attempting to populate or fill a typed dataset using the data from my back end ms access database.
I am using this website as a template:
I am stuck at the initilize data function, which is called in the page_load() function. The typed dataset, Dataset1, and the corresponding table, WorkExperianceData are connected to my access database.
Here is my code thus far:
Dim MyRs As New ADODB.Recordset()
Dim MyCn As New ADODB.Connection()
MyCn.Open("Provider=Microsoft.jet.oledb.4.0;data source=d:\workdata.mdb")
MyRs.Open("Select * from WorkExperianceData", MyCn, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockOptimistic)
'Create and fill the DataSet from the Recordset. Populate the grid from the DataSet.
Dim myDA As OleDbDataAdapter = New OleDbDataAdapter()
myDA.Fill(DataSet1.WorkExperianceDataDataTable, MyRs, "WorkExperianceData")
DataGrid1.DataSource = DataSet1.Tables(0)
MyRs = Nothing
MyCn.Close()
MyCn = Nothing
Specifically, I am getting errors at the "myDA.Fill...." and the subsequent "DataGrid.Datasource = ..." line, as the compiler says that the use of DataSet is an invalid declaration.
Thanks in advance.