On Mar 1, 9:22 pm, Dale Edmondson
<DaleEdmond...@discussions.microsoft.com> wrote:
> More Info:
> I tried the same test using a desktop app and everything works as expected
[quoted text clipped - 88 lines]
> > >> Just a thought. Check to make sure the string column values don't
> > >> have trailing spaces.
Sounds like data conversion is taking place somewhere (from string to
numeric) so that the leading "0" is lost in translation. You may want
to check all places where data conversion may come into play, whether
it's the insert statement, select statement, even the replication
routines if any are involved. These issues usually end up being
something trivial that we tend to overlook. It could be a bug, but
something as obvious as this would have been reported by others before.
Dale Edmondson - 04 Mar 2008 13:25 GMT
Just on last note. The reader returns the correct record when using the
following parameter query.
cmd.CommandText = "select [customer id] from Customers where [customer
id] = @NameID";
cmd.Parameters.Add("@NameID", SqlDbType.NVarChar, 15);
cmd.Parameters["@NameID"].Value = "0123";
SqlCeDataReader rdr = cmd.ExecuteReader();
while (rdr.Read())
{
MessageBox.Show(rdr.GetString(0));
}
> On Mar 1, 9:22 pm, Dale Edmondson
> <DaleEdmond...@discussions.microsoft.com> wrote:
[quoted text clipped - 98 lines]
> something trivial that we tend to overlook. It could be a bug, but
> something as obvious as this would have been reported by others before.
Ginny Caughey [MVP] - 04 Mar 2008 14:17 GMT
Dale,
Thanks for this update. Sometimes values are translated incorrectly, and by
specifying the parameter type you avoid that potential issue. I've also had
good luck with Paraneters.AddWithValue compared with not specifying the
value type. I don't know why AddWithValue seems to do a better job of
inferring the data type even in the desktop, but in any case specifying the
type is the surest way to get it right.

Signature
Ginny Caughey
Device Application Development MVP
www.wasteworks.com
Scalehouse and Billing Software for Waste Management
> Just on last note. The reader returns the correct record when using the
> following parameter query.
[quoted text clipped - 124 lines]
>> something trivial that we tend to overlook. It could be a bug, but
>> something as obvious as this would have been reported by others before.
Dale Edmondson - 04 Mar 2008 14:49 GMT
Interesting--While reading your response I noticed the parameter for the Name
Id specifies a length of 15 and it should be 5. In any case it worked.
Thanks again for your help.
> Dale,
>
[quoted text clipped - 133 lines]
> >> something trivial that we tend to overlook. It could be a bug, but
> >> something as obvious as this would have been reported by others before.