<p>I'm basically trying to figure out the simplest way to perform your basic insert operation in C#.NET using the SqlClient namespace. </p>

<p>I'm using <code>SqlConnection</code> for my db link, I've already had success executing some reads, and I want to know the simplest way to insert data. I'm finding what seem to be pretty verbose methods when I google.</p>

[{'answer_id': 32005, 'author': 'Matt Hamilton', 'author_id': 615, 'author_profile': 'https://Stackoverflow.com/users/615', 'pm_score': 5, 'selected': True, 'text': '<pre><code>using (var conn = new SqlConnection(yourConnectionString))\n{\n    var cmd = new SqlCommand("insert into Foo values (@bar)", conn);\n    cmd.Parameters.AddWithValue("@bar", 17);\n    conn.Open();\n    cmd.ExecuteNonQuery();\n}\n</code></pre>\n'}, {'answer_id': 32006, 'author': 'aku', 'author_id': 1196, 'author_profile': 'https://Stackoverflow.com/users/1196', 'pm_score': 0, 'selected': False, 'text': '<pre><code>using (SqlConnection myConnection new SqlConnection("Your connection string")) \n{ \n    SqlCommand myCommand = new SqlCommand("INSERT INTO ... VALUES ...", myConnection); \n    myConnection.Open(); \n    myCommand.ExecuteNonQuery(); \n}\n</code></pre>\n'}, {'answer_id': 32495, 'author': 'AlexCuse', 'author_id': 794, 'author_profile': 'https://Stackoverflow.com/users/794', 'pm_score': 2, 'selected': False, 'text': '<p>Since you seem to be just getting started with this now is the best time to familiarize yourself with the concept of a Data Access Layer (<a href="http://en.wikipedia.org/wiki/Data_access_layer" rel="nofollow noreferrer">obligatory wikipedia link</a>).  It will be very helpful for you down the road when you\'re apps have more interaction with the database throughout and you want to minimize code duplication.  Also makes for more consistent behavior, making testing and tons of other things easier.</p>\n'}]
['https://Stackoverflow.com/questions/32000', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1344/']