C# - SQLClient - Simplest INSERT

后端 未结 3 1886
失恋的感觉
失恋的感觉 2021-01-05 00:11

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

I\'m using SqlConnection<

3条回答
  •  刺人心
    刺人心 (楼主)
    2021-01-05 00:36

    using (SqlConnection myConnection new SqlConnection("Your connection string")) 
    { 
        SqlCommand myCommand = new SqlCommand("INSERT INTO ... VALUES ...", myConnection); 
        myConnection.Open(); 
        myCommand.ExecuteNonQuery(); 
    }
    

提交回复
热议问题