Wael Hilal
Wael Hilal

Reputation: 11

How do I know the column values that will be inserted into a datasource table when using SQLDataAdapter.Update

I need to check the column's values that will be inserted into the data source database table before executing the Insert using a SqlDataAdapter.Update method.

Is the following command the right command?

scb.GetInsertCommand().Parameters["@ProductName"].Value.ToString(); -- scb is SqlCommandBuilder

it always throws a Null exception:

"unhandled exception of type 'System.NullReferenceException' occurred..."

which means @ProductName parameter has null value !!!

I don't give any value for any parameter. the column's values come from the datagridview which has a datatable as a source.

the insert process is always Succeeded but I need to check the inserted values before the insertion.

Upvotes: 1

Views: 28

Answers (0)

Related Questions