On the Lambda

Programming, Technology, and Systems Administration

On the Lambda

Entries Tagged as 'sql'

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 […]

[Read more →]

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 […]

[Read more →]

Tags: