N
Nick
Hi
I'm very new to this so forgive me if I've made very amateur mistakes.
I am writing a web page for work so that items in a database can be queried
and then amended if required.
I've written a function which returns a DataSet.
I call this function from a sub procedure and assign the returned DataSet to
a new dataset object (dsTable) with page level scope (dim at top of page).
I then bind this data to a DataGrid control. All of this works fine.
I then want to enter the row number of an item in the DataGrid and assign a
new value to a column of the selected row.
I'm doing this very simply by adding a text box for the user to enter the
row number then to click a button to apply the changes.
The button event calls the Preview sub and passes the row number.
The way I expected this to work was
private sub Preview(intLine as Integer)
dim tSelect as DataTable
tSelect = dsTable.Tables("Orders")
tSelect.Rows(strLine).Item("Cost")=txtCos.Text '****Error here ***
dgOrders.DataSource=dsTable dgOrders.DataBind()
end sub
However at the line of code I've highlighted I get an error saying "Object
reference not set to an instance of an object."
What does this mean.
Any help would be greatly appreciated as it's driving me mad ).
Thanks
I'm very new to this so forgive me if I've made very amateur mistakes.
I am writing a web page for work so that items in a database can be queried
and then amended if required.
I've written a function which returns a DataSet.
I call this function from a sub procedure and assign the returned DataSet to
a new dataset object (dsTable) with page level scope (dim at top of page).
I then bind this data to a DataGrid control. All of this works fine.
I then want to enter the row number of an item in the DataGrid and assign a
new value to a column of the selected row.
I'm doing this very simply by adding a text box for the user to enter the
row number then to click a button to apply the changes.
The button event calls the Preview sub and passes the row number.
The way I expected this to work was
private sub Preview(intLine as Integer)
dim tSelect as DataTable
tSelect = dsTable.Tables("Orders")
tSelect.Rows(strLine).Item("Cost")=txtCos.Text '****Error here ***
dgOrders.DataSource=dsTable dgOrders.DataBind()
end sub
However at the line of code I've highlighted I get an error saying "Object
reference not set to an instance of an object."
What does this mean.
Any help would be greatly appreciated as it's driving me mad ).
Thanks