Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I am making a web service call that returns a message bean that has 50 packets. I then put it into my SQLite the following way

public void DashboardHandler(Array Bean, long cNum)
    {
        foreach (invoiceSummaryBean ib in Bean)
        {
            var dash = new dashboardCustomer
            {
                actualUsage = ib.actualUsage,
                serviceCost = ib.serviceCost,
                mmbtu = ib.mmbtu,
                OptiServiceCost = ib.optimizedServiceCost,
                period = ib.period,
                periodType = ib.periodType,
                service = ib.service,
                serviceType = ib.serviceType,
                measure = ib.unitOfMeasure,                    
                customerNumber = cNum
            };

            try
            {
                db.insertDashboard(dash);
            }
            catch
            {

            }
        }
    }

My insert Method

public async Task insertDashboard(dashboardCustomer d)
    {
        try
        {
            await db.InsertAsync(d);
        }
        catch(SQLiteException)
        {
            throw;
        }
    }

My Table

[Table("dashboardCustomer")]
public class dashboardCustomer
{

    public long customerNumber { get; set; }        
    public int period { get; set; }
    public string periodType { get; set; }
    public string service { get; set; }
    public double actualUsage { get; set; }
    public double mmbtu { get; set; }
    public double OptiServiceCost { get; set; }        
    public double serviceCost {get; set;}        
    public string serviceType { get; set; }        
    public string measure { get; set; }


}

When it tries to insert it crashes saying {"Constraint"}?

Not sure what the problem is. I need all 50 packets to insert into the table.

share|improve this question
    
I'm not 100% sure, but you may need to label the properties in dashboardCustomer as Columns. –  Nate Diamond Jul 16 '13 at 19:47

1 Answer 1

up vote 0 down vote accepted

I figured out the issue with this problem. I had to change how the table was created. It strangely has to be recreated every time new data is inserted.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.