Less than a week ago, a tornado tore through a small town about 25 miles from my home, leaving it almost completely devastated. I am thankful that no one I know personally was hurt or even lost significant property, but I’ve had some stories from the experience, and I am very mindful and prayerful for those […]
Entries from May 14th, 2014
Can we stop using AddWithValue() already?
May 12th, 2014 · 13 Comments · .net, c#, sql
I see code examples posted online all the time that look like this: cmd.Parameters.AddWithValue(“@Parameter”, txtTextBox1.Text); This needs to stop. There is a problem with the AddWithValue() function: it has to infer the database type for your query parameter. Here’s the thing: sometimes it gets it wrong. This especially happens with database layers that deal in Object arrays […]
Tags:
The N Word
May 9th, 2014 · No Comments · sql, Sql Server
No, not that N word. I’m talking about N string literal prefixes in T-SQL. Like this: SELECT * FROM Foo WHERE Bar = N’Baz’ If you don’t know what that N is for, it tells Sql Server that your string literal is an nvarchar, rather than a varchar… that is, that the string literal may […]
Tags: