Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SqlString in c#

Tags:

c#

sql

I just found in some code that it uses System.Data.SqlTypes.SqlString? I haven't seen it used before. Am I always supposed to use this when sending a string to sql server?

e.g.

cmd.Parameters.Add("@FirstName", (SqlString)FirstName);
like image 542
Joe Avatar asked Mar 05 '26 22:03

Joe


1 Answers

No, it's fine - you can just use string and the framework/driver will take care of things for you.

like image 60
Jon Skeet Avatar answered Mar 08 '26 12:03

Jon Skeet



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!