2

I am using Entity framework 4.1, the following method I am using to insert data in the table it is not inserting data in the table.

Method:

    private void InsertSMSStatus(Request request)
    {
        UtilitiesEntities context = new UtilitiesEntities();
        SMSAlertLog alertLog = new SMSAlertLog();
        alertLog.Recipients = request.To;
        alertLog.Sender = From;
        alertLog.Status = Convert.ToInt32(request.ResponseString);
        context.SaveChanges();
        context.Dispose();
    }

The Connection string:

<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0" /></startup><connectionStrings><add name="UtilitiesEntities" connectionString="metadata=res://*/DataModel.SmsEntityModel.csdl|res://*/DataModel.SmsEntityModel.ssdl|res://*/DataModel.SmsEntityModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=bosql1srv;initial catalog=Utilities;integrated security=True;multipleactiveresultsets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" /></connectionStrings></configuration>

Any Idea?

2
  • 2
    You haven't inserted anything into your context. You need to do something like that: context.AlertLogs.Add(alertLog); context.SaveChanges(); .. depending on your context of course. Commented Jun 3, 2013 at 12:15
  • oops that was a misss.... Thanks Commented Jun 3, 2013 at 12:16

1 Answer 1

7

You are not adding your entity into context.

context.SMSAlertLogs.Add(alertLog); // name of entity set may change. It might not be SMSAlertLogs 
context.SaveChanges();
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.