Showing posts with label device. Show all posts
Showing posts with label device. Show all posts

Monday, March 26, 2012

Pushing IMAGE from SQL CE onto SQL Server 2000

Hello!

We are trying to use RDA to Push an image field onto SQL Server 2000 from a mobile device, but are having problems. Does anyone have any experience with this? If so, maybe some sample code would be very much appreciated. (We have been struggling with this for a while).

byte[] imagearray = null;

string imagestring = "";

try

{

imagearray = (byte[])SQLCEDr.GetValue(SQLCEDr.GetOrdinal("CapturedImage"));

imagestring = System.Text.Encoding.Default.GetString(imagearray, 0, (imagearray.Length - 1));

}

catch (Exception ex)

{

MessageBox.Show(ex.Message);

}

sParameters = "'" + imagestring + "'" ;

try

{

rda.SubmitSql("EXEC sp_HH_WorkOrder_SuppliesUsed " + sParameters,scon);

}

Thanks,

Andy

Here’s the problem:

imagestring = System.Text.Encoding.Default.GetString(imagearray, 0, (imagearray.Length - 1));

This line would be valid for an array which contains text in the default encoding. But it contains binary image data which would be treated as text, corrupted and lost.

To insert/retrieve binary data you have to use parameterized query. In fact, you should use parameterized queries for everything - would save you lot of troubles with localization (e.g. infamous 10/25/2006 vs. 25.10.2006) and formatting not to mention more secure and better performing code. If you don't know how to use parameters, please look it up on MSDN or search this forum as it's been answered before.

Saturday, February 25, 2012

Publish scenario - how can this work?

Our current setup has a hand held device, a laptop and head office. The
field reps have the hand held and laptop and need to get and send data back
to head office. Merge Replication seems to be the answer and I was thinking
that the Head Office would publish to the Laptop and the Laptop would then
publish to the Hand Held. But SQL Server 2005 Express can only be a
Subscriber and not a Publisher.
The reason to do this is that only certain rows will be published to the
laptop (say 1 weeks work) and then only certain rows (say 1 or 2 days work)
will be published to the hand held.
Is there a way to accomplish this?
Here's how it breaks down:
Head Office = SQL Server 2005 Standard Edition
Laptop = SQL Server 2005 Express Edition
Hand Held = SQL Server 2005 Compact Edition
Thanks,
Richard.
You might want to look at RDA as the transit mechanism between Express and
the HandHelds.
Otherwise I would replicate from the Standard Edition publisher to the
handhelds.
http://www.zetainteractive.com - Shift Happens!
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
"Richard Wodabek" <rwodabek@.cogeco.ca> wrote in message
news:uocMysrNIHA.2268@.TK2MSFTNGP02.phx.gbl...
> Our current setup has a hand held device, a laptop and head office. The
> field reps have the hand held and laptop and need to get and send data
> back
> to head office. Merge Replication seems to be the answer and I was
> thinking
> that the Head Office would publish to the Laptop and the Laptop would then
> publish to the Hand Held. But SQL Server 2005 Express can only be a
> Subscriber and not a Publisher.
> The reason to do this is that only certain rows will be published to the
> laptop (say 1 weeks work) and then only certain rows (say 1 or 2 days
> work)
> will be published to the hand held.
> Is there a way to accomplish this?
> Here's how it breaks down:
> Head Office = SQL Server 2005 Standard Edition
> Laptop = SQL Server 2005 Express Edition
> Hand Held = SQL Server 2005 Compact Edition
> Thanks,
> Richard.
>
|||Thanks Hilary, RDA might work for us.
Any chance 2008 Express Edition will allow Publishing?
Richard.
"Hilary Cotter" <hilary.cotter@.gmail.com> wrote in message
news:uNmcUmzNIHA.292@.TK2MSFTNGP02.phx.gbl...[vbcol=seagreen]
> You might want to look at RDA as the transit mechanism between Express and
> the HandHelds.
> Otherwise I would replicate from the Standard Edition publisher to the
> handhelds.
> --
> http://www.zetainteractive.com - Shift Happens!
> Looking for a SQL Server replication book?
> http://www.nwsu.com/0974973602.html
> Looking for a FAQ on Indexing Services/SQL FTS
> http://www.indexserverfaq.com
> "Richard Wodabek" <rwodabek@.cogeco.ca> wrote in message
> news:uocMysrNIHA.2268@.TK2MSFTNGP02.phx.gbl...
then
>