Question

I've been having issues trying to connect mySQL Server MC9190 (barcode scanner) to a SQL Server database and I've been having issues. 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:

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."

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();
}
Was it helpful?

Solution

As far as I'm aware, you cannot use Express on it. You will need to use Compact.

Here is a tutorial on setting up SQL CE with C# Apps. http://www.dotnetperls.com/sqlce

Here are the install instructions for CE 6 (MS SQL Compact needs an extra install). 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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top