2012年8月8日

ADO code

string connectionString = "Data Source=xxx;Initial Catalog=yyy;Integrated Security=True;Application Name=zzz"

string command = "SELECT ... FROM ... WHERE ... ";

using (SqlConnection connection = new SqlConnection(connectionString))
{
    connection.Open();

    SqlCommand command = new SqlCommand(sqlInsertCommand, connection);
    command.Parameters.Clear();
    command.Parameters.AddWithValue("@Id", Id);

    command.ExecuteNonQuery();

    command.Cancel();
}

沒有留言:

張貼留言