我一直有問題試圖連接MySQL服務器MC9190(條碼掃描器)到SQL Server數據庫,我一直有問題。它工作正常,當我在我的桌面上運行,但是當我試圖在Windows CE 6.0上運行我的Pocket PC上運行它,它拋出的錯誤:使用Windows CE 6.0連接到SQL Server或MySQL數據庫
System.TypeLoadException was unhandled
Message="File or assembly name 'System.Data.SqlClient, Version=3.0.3600.0,Culture=neutral, PublicKeyToken=3BE235DF1C8D2AD3', or one of its dependencies, was not found."
任何人有任何想法如何我的Pocket PC連接到數據庫,所以我可以輸入我從掃描儀收集的數據到數據庫中?當我試圖連接到數據庫時,以下是我的代碼:
SqlConnection myConnection = new SqlConnection("Server=*****\\SQLEXPRESS;DATABASE=testing;Trusted_Connection=yes;connection timeout=15;user id=************");
try
{
//open the server
myConnection.Open();
//Insert values passed into the metod
SqlCommand myCommand = new SqlCommand("INSERT INTO test (Part_Number, total, number_of_packs, dunsNumber, serialNumber, truck_number) VALUES (@Part_Number,@total,@number_of_packs,@dunsNumber,@serialNumber,@truck_number)", myConnection);
myCommand.Parameters.AddWithValue("@Part_Number", partNumber);
myCommand.Parameters.AddWithValue("@total", total);
myCommand.Parameters.AddWithValue("@number_of_packs", numOfPacks);
myCommand.Parameters.AddWithValue("@dunsNumber", dunsNumber);
myCommand.Parameters.AddWithValue("@serialNumber", serialNumber);
myCommand.Parameters.AddWithValue("@truck_number", laneNumber);
//execute the query
myCommand.ExecuteNonQuery();
myConnection.Close();
}
什麼版本的System.Data.SqlClient安裝在Pocket PC上? – ChrisBint
@ChrisBint在我的程序中引用的版本是3.0.3600.0 – AlvinJ