Skip to content Skip to sidebar Skip to footer

How Do I Execute An INSERT Using SqlCommand?

I have another class that creates the connection (see refined class half way down page) and I believe it connects or at lest I do not hit any of the exceptions in run time. I woul

Solution 1:

 Command.ExecuteNonQuery();

By the way, you're missing a parenthesis in your SQL query string.

And of course, you'd use parameters in a real query (and you will not use string concatenation instead of passing parameters as it'll open doors for destructive SQL injection attacks).


Post a Comment for "How Do I Execute An INSERT Using SqlCommand?"