2010-02-28 65 views
0

我使用Subsonic 3.0.0.3與ActiveRecord,對MySQL數據庫運行。我發現這工作得很好:與MySQL提供商的SubSonic崩潰

// Approach 1 
var db = new testDB(); 
db.Insert.Into<company>(c => c.name) .Values("Acme") .Execute(); 

但這種崩潰:

// Approach 2 
company c = new company(); 
c.name = "Acme"; 
c.Save(); 

崩潰不是即時的,但關機:

One of the background threads threw exception: System.NullReferenceException: Object reference not set to an instance of an object. 
    at MySql.Data.MySqlClient.NativeDriver.FetchDataRow(Int32 statementId, Int32 columns) 
    at MySql.Data.MySqlClient.Driver.FetchDataRow(Int32 statementId, Int32 columns) 
    at MySql.Data.MySqlClient.Driver.SkipDataRow() 
    at MySql.Data.MySqlClient.ResultSet.Close() 
    at MySql.Data.MySqlClient.MySqlDataReader.NextResult() 
    at MySql.Data.MySqlClient.MySqlDataReader.Close() 
    at MySql.Data.MySqlClient.MySqlConnection.Close() 
    at MySql.Data.MySqlClient.MySqlConnection.Dispose(Boolean disposing) 
    at System.ComponentModel.Component.Finalize() 
Test host process exited unexpectedly. 

鑑於與方法1 I無法弄清楚如何獲得新插入的記錄ID和方法2它崩潰,我有點卡...

有任何想法嗎?

回答