First, I'm pretty new to LINQ to SQL, so this is probably a dumb question, but I'm trying to insert a new record into the database and I keep getting the following error:
The client was unable to establish a connection because of an error during connection initialization process before login. Possible causes include the following: the client tried to connect to an unsupported version of SQL Server; the server was too busy to accept new connections; or there was a resource limitation (insufficient memory or maximum allowed connections) on the server. (provider: Shared Memory Provider, error: 0 - The handle is invalid.)
I can step through my code and see that all the data is present as I would expect it to, but when it hits the
db.SubmitChanges()
in the method below I get the error. What am I doing wrong? This is SOO frustrating and I've lost a day trying to figure out LINQ to SQL... I'm half tempted to just bag it and go back to using ADO.NET and stored procs.
public static void Save(Customer customerToSave)
{
IpmDatabaseDataContext db = new IpmDatabaseDataContext();
db.Customers.InsertOnSubmit(customerToSave);
// commit the changes to the db
db.SubmitChanges();
}
In my app.config it has this connection string:
<connectionStrings>
<add name="IPM.Business.Properties.Settings.IPMConnectionString"
connectionString="Data Source=socrates\sqlexpress;Initial Catalog=IPM;Integrated Security=True"
providerName="System.Data.SqlClient" />
</connectionStrings>
I am still on my dev machine, so this is the correct connection string.