[英]Connecting to a SQL Server or MySQL database with Windows CE 6.0
I've been having issues trying to connect mySQL Server MC9190 (barcode scanner) to a SQL Server database and I've been having issues. 尝试将mySQL Server MC9190(条形码扫描器)连接到SQL Server数据库时遇到问题,并且遇到了问题。 It works fine when I run on my desktop, but when I try to run it on my pocket PC that runs on Windows CE 6.0 it throws the error:
当我在台式机上运行时,它工作正常,但是当我尝试在运行Windows CE 6.0的袖珍PC上运行它时,会引发错误:
System.TypeLoadException was unhandled
System.TypeLoadException未处理
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."找不到消息=“文件或程序集名称'System.Data.SqlClient,版本= 3.0.3600.0,文化=中性,PublicKeyToken = 3BE235DF1C8D2AD3'或其依赖项之一。”
Anyone have any idea how to connect my pocket pc to the database so I can input the data I collect from the scanner into the database? 任何人都知道如何将我的掌上电脑连接到数据库,以便可以将我从扫描仪收集的数据输入数据库吗? Here is my code when I'm trying to connect to the database:
这是我尝试连接数据库时的代码:
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();
}
As far as I'm aware, you cannot use Express on it. 据我所知,您不能在其上使用Express。 You will need to use Compact.
您将需要使用Compact。
Here is a tutorial on setting up SQL CE with C# Apps. 这是有关使用C#Apps设置SQL CE的教程。 http://www.dotnetperls.com/sqlce
http://www.dotnetperls.com/sqlce
Here are the install instructions for CE 6 (MS SQL Compact needs an extra install). 这是CE 6的安装说明(MS SQL Compact需要额外的安装)。 http://msdn.microsoft.com/en-us/library/13kw2t64(v=vs.90).aspx
http://msdn.microsoft.com/en-us/library/13kw2t64(v=vs.90).aspx
Edit: --> this is assuming you are trying to use a database on the machine itself. 编辑:->这是假设您尝试在计算机本身上使用数据库。 Otherwise this won't be your answer.
否则,这将不是您的答案。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.