Hi,
I am saving a record and trying to update the data in the datagrid, BUT alas things are not running smooth and I havent learnt all the errors yet. Heres my code
Dim da As OleDbDataAdapter
Dim dt As DataTable
Dim cn As OleDbConnection
Dim cmd As OleDbCommand
Dim dr As OleDbDataReader
da = New OleDbDataAdapter("Select * from Tools", cn)
dt = New DataTable
da.Fill(dt)
dg.DataSource = dt
Dim drow As System.Data.DataRow
drow = dt.NewRow()
drow.Item("ToolID") = tID
drow.Item("Description") = Desc
drow.Item("Price") = Price
drow.Item("CompanyID") = cID
drow.Item("BoughtDate") = bDate
dt.Rows.Add(drow)
I get the error on the code da = New OleDbDataAdapter("Select * from Tools", cn)
the error reads SelectCommand.Connection property has not been initialised. Anyone know why????
Ph and if anyone spots a future error dont be shy in pointing it out.
Thank You very much.
I am saving a record and trying to update the data in the datagrid, BUT alas things are not running smooth and I havent learnt all the errors yet. Heres my code
Dim da As OleDbDataAdapter
Dim dt As DataTable
Dim cn As OleDbConnection
Dim cmd As OleDbCommand
Dim dr As OleDbDataReader
da = New OleDbDataAdapter("Select * from Tools", cn)
dt = New DataTable
da.Fill(dt)
dg.DataSource = dt
Dim drow As System.Data.DataRow
drow = dt.NewRow()
drow.Item("ToolID") = tID
drow.Item("Description") = Desc
drow.Item("Price") = Price
drow.Item("CompanyID") = cID
drow.Item("BoughtDate") = bDate
dt.Rows.Add(drow)
I get the error on the code da = New OleDbDataAdapter("Select * from Tools", cn)
the error reads SelectCommand.Connection property has not been initialised. Anyone know why????
Ph and if anyone spots a future error dont be shy in pointing it out.
Thank You very much.