まず、私は LINQ to SQL を初めて使用するので、これはおそらくばかげた質問ですが、データベースに新しいレコードを挿入しようとすると、次のエラーが発生し続けます。
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.)
コードをステップ実行して、期待どおりにすべてのデータが存在することを確認できますが、
db.SubmitChanges()
以下の方法でエラーが発生します。私は何を間違っていますか?これは非常にイライラすることであり、LINQ to SQL を理解するのに 1 日を費やしてしまいました... それを袋に入れて、ADO.NET とストアド プロシージャの使用に戻りたいと思っています。
public static void Save(Customer customerToSave)
{
IpmDatabaseDataContext db = new IpmDatabaseDataContext();
db.Customers.InsertOnSubmit(customerToSave);
// commit the changes to the db
db.SubmitChanges();
}
私の app.config には、次の接続文字列があります。
<connectionStrings>
<add name="IPM.Business.Properties.Settings.IPMConnectionString"
connectionString="Data Source=socrates\sqlexpress;Initial Catalog=IPM;Integrated Security=True"
providerName="System.Data.SqlClient" />
</connectionStrings>
私はまだ開発マシンにいるので、これは正しい接続文字列です。