Member Avatar

As it seems to come up often enough I figured I'd throw together a quick snippet outlining basic methods for data manipulation in SQL Server using C#. In all examples the coder will need to substitute their own connection string details and variables. I utilised parameters for 3 of the examples but they can just as easily be replaced by direct references to dynamic controls in your application if desired. The benefit of parameters, however, is that they set the 'type' of the variable being passed and add an additional level of type checking to the app. I'm hoping I …

Member Avatar
+2 forum 13
Member Avatar

As suggested by Duki in [URL="http://www.daniweb.com/forums/thread298488.html"]this thread[/URL] I figured I'd compile all the workable examples and explanations here towards the question of "Why do we use get/ set to change properties?" [QUOTE=pritesh2010]Properties provide the opportunity to protect a field in a class by reading and writing to it through the property. C# properties enable this type of protection while also letting you access the property just like it was a field. Becuase of get /set our class contains control over the input. let say E.g. if you don't need to use get/set. you colud write function for setfunct or getfunct …

+2 forum 0

The End.