Showing posts with label mobile. Show all posts
Showing posts with label mobile. Show all posts

Friday, February 24, 2012

Can't merge replicate to PocketPC

Hello

I want to merge replicate my mdf to two PocketPCs running Windows Mobile 5.0/SQL Server Mobile and PocketPC 2003 SE/SQL Server CE 2.0. I've got SQL Server 2000 installed on a Windows Server 2003 machine. I've followed this guide: http://www.codeproject.com/database/MergeReplication.asp, but now I don't know how to add SQL Server Mobile/CE to the list of subscribers after creating the publication. I'm really lost. Does anyone know of an easy step by step guide.

Thanks!

Rudi

Have you tried reading SQL 2000 Books Online? Search for topic "Replication with SQL Server 2000 Windows CE".

Thursday, February 16, 2012

Can't install SQL Server 2005 Mobile Edition Server Tools Beta 1

I'm working with VS.NET 2005 Beta2 and SQL Server 2005 April CTP. My
SQL Server 2005 installation was more or less full, that is, I
installed everything related to Client Connectivity. I was bound to
build a merge replication scenario when I've noticed I needed "SQL
Server 2005 Mobile Edition Server Tools Beta 1".
Download the installer and execute it, obtaining the following error:
"You must first install the Replication Components for SQL Server 2000
SP 3a or higher or the SQL Server 2005 Client Connectivity Components."
What is the problem here if I have installed all Client components?
Any help will be greatly appreciated.
Instead of downloading "SQL Server 2005 Mobile Edition Server Tools
Beta 1" from Microsoft, which still warns me that I cannot replicate
with SQL Server 2005 because I don't have Client Connectivity
Components installed, I finally read this on MSDN2:
http://msdn2.microsoft.com/en-us/library/ms171908
The setup file is "sqlce30setupen.msi", located at "C:\Program
Files\Microsoft SQL Server\90\Tools\binn\VSShell\Common7\IDE". This
setup process went ok and did not warn me about anything.
Hope it helps people having the same problem.
PS: How does MS redirect developers to download Server Tools Beta 1 in
order to setup replication and then setup fails or warns the user
wihout any logical reason. Incredible! Can anybody explain me this?

Sunday, February 12, 2012

Can't Insert Binary Data Into Sql Mobile

Hi guys, I'm having a problem inserting a file into a SQL Mobile table.

I'm updating the table via a tableadapter designed through the Dataset designer in VS2k5.

The SQL used to insert is "Insert into TestTable (itemid,itemdata) values (@.itemid,@.itemdata)"

Where ItemID is a GUID, and ItemData is an Image field. The tableadapter has typed the parameters as GUID and Binary properly already.

Only problem is when I actually call the command with a byte array containing my file, I get a "Byte truncation" error message.

I remember this working properly in SQL CE 2.0 but so far I don't seem to get it to work in SQL mobile, anyone got any pointers?

How big is the array? If you try to insert array of, say, one byte in size, does that work?

|||

Here is a sample of what you need to do to insert binary data into an image column in SQL Mobile:

MemoryStream ms = new MemoryStream();
pictureBox1.Image.Save(ms, ImageFormat.Jpeg);
byte[] imageBytes = ms.ToArray();

SqlCeConnection cn = DatabaseManager.GetInstance().DBConnection;
string sql = "INSERT INTO Photos (ID, Photo) VALUES (NewID(), ?)";
SqlCeCommand command = new SqlCeCommand(sql, cn);

command.Parameters.Add("@.image", SqlDbType.Image, imageBytes.Length);

command.Parameters["@.image"].Value = imageBytes;

command.ExecuteNonQuery();

-Darren