Skip to content

problem with connection string #7

@GusBeare

Description

@GusBeare

I have the following code:

 using (var context = new DataContext("SiteSQLServer",Transaction.Begin))
            {
                var job = new DataObject<omv_JobSeekerReferences>();
                int cntr = 1;
                foreach (var item in ViewState)
                {
                    omv_JobSeekerReferences r = (omv_JobSeekerReferences) ViewState["item_" + cntr];

                    var newRefRow = new omv_JobSeekerReferences { UserId = r.UserId,Company = r.Company, FromDate = r.FromDate, ToDate = r.ToDate };
                    job.Insert(newRefRow); // add the new row to the table
                    cntr++; 
                }
            }

It blows on job.Insert complaining that it can't find the connection string "Default".
Am I doing something wrong? It works fine if I add a default connection string and the row is inserted.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions