c# - How would I add a parameter to entity framework raw sql command -


how add parameter following entity framework raw sql command? example, if wanted make id parameter?

        using (var context = new northwinddbentities())         {             context.database.executesqlcommand(@"                 update dbo.customers                  set name = 'test' id = 1             ");          } 

context.database.executesqlcommand(@"update dbo.customers              set name = 'test' id = @id", new sqlparameter("id", 1)); 

in case of multiple parameters

context.database.executesqlcommand(@"update dbo.customers              set name = 'test' id = @id , name =@name",                 new sqlparameter("id", id),                new sqlparameter("name", fname)); 

Comments

Popular posts from this blog

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -