Tech Off Post

Single Post Permalink

View Thread: SqlParameter properties (.NET1.1)
  • User profile image

    • SourceVersion
    • SourceColumn
    Those two are used with datasets and data adapters. The deal is you tell the param object that it should use column "FooBar", the version represents (i'm guessing a bit off of the top of my head) how to handle any outputs / etc. for that field in regards to the data currently in the dataset.

    So, you have a dataset with columns ABar, BBar and FooBar, you have three param objects which do not actually have a value -- they just have the sourcecolumns set, and the versions to tell how to transfer the updated value (whether to update, merge, etc -- docs should say that).

    • Direction
    This is input, output or both.  In TSQL, for a sproc or whatever you can have the parameters bee @param1, @param2 OUTPUT, @param3,  where param2 is of type either input output, or output, depending on how you're using it.

    For return values, just return the value and setup the param as @RETURN_VALUE and a parameter direction as ReturnValue (check "Output" if that does not exist in 1.1)

    • Size
    As for the size, for text and blobs, I wouldn't set it since it is variable and can be basically anything. Sql is reporting the size to store the pointer to the location where it actually will exist - that size can be fairly big, so it is best to let it be dynamic.

    I'm a bit confused on the comment about lack of documentation, there seem to be gobs of resources on the net for anything sqlcommand / dataadapter related.  I searched for a couple of the above and found lots of hits. Just bounce around 'ole google.  .net 2.0 and 1.1 are very similar in how they implement the command object, so you should be able to look at those examples too.