mshvw

See below code:

---> mySqlCommand.Parameters.Add("@myVar",SqlDbType.Bit).Direction = ParameterDirection.Output

my free translation:

---> Object.Add("").Direction = something

I do not understand assigning 'something' to the 'Object.Add().Direction' method using the '=' operator.

Has it something to do with a 'Set' function

(my lack of C# knowledge...)

Where or how can I deduce from the 'SqlCommand.Parameters' online help that you can assign the 'ParameterDirection' to the 'SqlCommand.Parameters.Add().Direction' method

regards,

Henk



Re: Visual C# Language Not understanding assigning a value to a method. (renewed)

Merin Gazell

Parameters.Add returns an unamed Parameter object(which is not assigned to anything) and that has a Direction property.



Re: Visual C# Language Not understanding assigning a value to a method. (renewed)

andypai

Hi Henk,

The statement - mySqlCommand.Parameters.Add("@myVar",SqlDbType.Bit) creates a SQLParameter object, adds it to the ParameterCollection and returns the newly created SQLParameter.

The statement -

---> mySqlCommand.Parameters.Add("@myVar",SqlDbType.Bit).Direction = ParameterDirection.Output

is just a shortcut way of writing -

Code Snippet

SQLParameter param = mySqlCommand.Parameters.Add("@myVar",SqlDbType.Bit);

param.Direction = ParameterDirection.Output;

Hope that helps..






Re: Visual C# Language Not understanding assigning a value to a method. (renewed)

mshvw

Thanks, Thanks!