SqlParameter constructor

F

Francois

Let say I have an Sql statement like

UPDATE Customer SET name=@name WHERE customerId=@customerId

I see that one of the overloaded SqlParameter constructor got the following
signature:
public SqlParameter(string parameterName, SqlDbType dbType, int size, string
sourceColumn);

What is the last parameter? is the the source column in the table of the DB
? But i do not understand why that would be needed as it anyway need to be
explicitly specified in the sql statement.
Or maybe is it the name of the column of the DataSet that the value needs to
be retrieved from in case I am using a DataAdapter and a DatSet to update
the DB? I think it must be this but i am not sure as in the MSDN doc, they
just mention :
sourceColumn
The name of the source column.

Tx to enlight me on this and I have to say I don't have much experience on
DataSet / DataAdapter yet.

Best regards,
Francois.
 
J

Joyjit Mukherjee

Hi,

Yes, it is been used for Datacolumn mapping between datasets & the actual
table column. Also, if the parameter direction is Input, the SourceColumn
property specifies the dataset column, actual table column for parameter
direction output, and both for InputOutput.

regards
Joyjit
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top