write something to database in nop 2.0?

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
12 yıl önce
hi.
somewhere in my payment module I need to write something to database.
but I'm not familiar with entity framework.
is there any problem with using the old fashioned ado.net?
and how can I use entity framework to accomplish a data insert into database?
12 yıl önce
Sometimes I need run a query without EF, here is what I do:


                var dataSettingsManager = new DataSettingsManager();
                var dataProviderSettings = dataSettingsManager.LoadSettings();

                using (SqlConnection connection = new SqlConnection(dataProviderSettings.DataConnectionString))
                {
                        SqlCommand cmd = new SqlCommand("UPDATE [dbo].[NOrder] SET [ExportedOnUtc] = GETUTCDATE() WHERE OrderID = @OrderID", connection);
                        cmd.Parameters.Add(new System.Data.SqlClient.SqlParameter { ParameterName = "OrderID", Value = order.Id });
                        connection.Open();
                        cmd.ExecuteNonQuery();
                }



I don't know if there is a simpliest way to get connexionString...
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.