S
SSP
Any ideas on how, I can save the PocketSignature (sample on MSDN) into a SQL
CE database?
SSP
CE database?
SSP
SSP said:Here's the "full" code
When I view the results of the sql query of the data entered, both "sig" and
"sig1", have the same data. This cannot be true, since they're both entered
from different paramaters i.e. _signature and _signature1
//The problem lies here.
Stream mstr;
Stream mstr1;
mstr = new MemoryStream(_signature.SignatureBits);
mstr1 = new MemoryStream(_signature1.SignatureBits);
byte [] sigData = new byte[mstr.Length];
byte [] sigData1 = new byte[mstr1.Length];
// Read it into byte array
mstr.Read(sigData, 0, (int)mstr.Length);
mstr1.Read(sigData1, 0, (int)mstr1.Length);
where am I going wrong?
SSP
Assembly.GetExecutingAssembly().GetManifestResourceStream("_signature.SignatSSP said:I know what the problem was for the below...Stream is an abstract class...
I now have another problem. When I tried to read the image from the database
I get a
................
An unhandled exception of type 'System.ArgumentException' occurred in
System.Drawing.dll
Additional information: ArgumentException
................
error
I have no problems reading from the the test database...just my production
database.
SSPof
type into
Alex Feinman said:If you are passing a byte array to a bitmap constructor, this array is
expected to have a file format - as if you have read a valid image file into
memory. This could be any of the supported file formats, but for your needs
you will have to use bitmap file format. You cannot simply use the pixel
data part. The file is expected to have BITMAPFILEHEADER and BITMAPINFO
structures in the header part.
For an example of building these headers see
http://www.alexfeinman.com/download.asp?doc=OnTheFlyBitmap.zip
It in fact contains a ready-to-use function that creates a bitmap from cx,
cy and byte[] pixel data
alreadySSP said:It's only the signature being read as image that gives this error.
If I insert an image file, I can read it fine. If it's the signature than,
then I get the ArgumentExecption error.
SSP
portion
ofAssembly.GetExecutingAssembly().GetManifestResourceStream("_signature.Signata
Assembly.GetExecutingAssembly().GetManifestResourceStream("DbAccess.Riverthe
idea MSDN)
into
SSP said:Hi Alex,
I looked at both your examples and have tried to save the signature as an
image in the database, but it only saves a black image.
I am passing "_signature.SignatureBits" as the byte[]
---X----X----
int h = 120, w = 216;
byte [] datax = _signature.SignatureBits;
byte[] sigbitmap = CreateBitmap(w, h, datax);
MemoryStream ms = new MemoryStream(sigbitmap);
FileStream fs = new FileStream(@"\sigData.gif", FileMode.Create,
FileAccess.Write);
fs.Write(sigbitmap, 0, sigbitmap.Length);
fs.Close();
Bitmap bmp = new Bitmap(ms);
pictureBox1.Image = bmp;
---X----X----
I really need to be able to save the signature as an image or else...this
app is useless.
SSP
Assembly.GetExecutingAssembly().GetManifestResourceStream("_signature.SignatAlex Feinman said:If you are passing a byte array to a bitmap constructor, this array is
expected to have a file format - as if you have read a valid image file into
memory. This could be any of the supported file formats, but for your needs
you will have to use bitmap file format. You cannot simply use the pixel
data part. The file is expected to have BITMAPFILEHEADER and BITMAPINFO
structures in the header part.
For an example of building these headers see
http://www.alexfeinman.com/download.asp?doc=OnTheFlyBitmap.zip
It in fact contains a ready-to-use function that creates a bitmap from cx,
cy and byte[] pixel data
alreadySSP said:It's only the signature being read as image that gives this error.
If I insert an image file, I can read it fine. If it's the signature than,
then I get the ArgumentExecption error.
SSP
I know what the problem was for the below...Stream is an abstract class...
I now have another problem. When I tried to read the image from the
database
I get a
................
An unhandled exception of type 'System.ArgumentException' occurred in
System.Drawing.dll
Additional information: ArgumentException
................
error
I have no problems reading from the the test database...just my production
database.
SSP
Hi Alex,
That's a great example... I am however still puzzled over this portion
of
the code:
In your code below, you are pointing to an image file which isa
part of the project:
...................
Stream str =
Assembly.GetExecutingAssembly().GetManifestResourceStream("DbAccess.River
Sumida.bmp");
....................
In my app, I have the code as below, but when I debug, I get a Null
Refence
error:
..................
Stream str =field
of
Alex Feinman said:You cannot save the image as a gif file this way. It must have BMP extension
Assembly.GetExecutingAssembly().GetManifestResourceStream("_signature.SignatSSP said:Hi Alex,
I looked at both your examples and have tried to save the signature as an
image in the database, but it only saves a black image.
I am passing "_signature.SignatureBits" as the byte[]
---X----X----
int h = 120, w = 216;
byte [] datax = _signature.SignatureBits;
byte[] sigbitmap = CreateBitmap(w, h, datax);
MemoryStream ms = new MemoryStream(sigbitmap);
FileStream fs = new FileStream(@"\sigData.gif", FileMode.Create,
FileAccess.Write);
fs.Write(sigbitmap, 0, sigbitmap.Length);
fs.Close();
Bitmap bmp = new Bitmap(ms);
pictureBox1.Image = bmp;
---X----X----
I really need to be able to save the signature as an image or else...this
app is useless.
SSP
fileAlex Feinman said:If you are passing a byte array to a bitmap constructor, this array is
expected to have a file format - as if you have read a valid image
intoAssembly.GetExecutingAssembly().GetManifestResourceStream("DbAccess.Rivermemory. This could be any of the supported file formats, but for your needs
you will have to use bitmap file format. You cannot simply use the pixel
data part. The file is expected to have BITMAPFILEHEADER and BITMAPINFO
structures in the header part.
For an example of building these headers see
http://www.alexfeinman.com/download.asp?doc=OnTheFlyBitmap.zip
It in fact contains a ready-to-use function that creates a bitmap from cx,
cy and byte[] pixel data
It's only the signature being read as image that gives this error.
If I insert an image file, I can read it fine. If it's the signature than,
then I get the ArgumentExecption error.
SSP
I know what the problem was for the below...Stream is an abstract
class...
I now have another problem. When I tried to read the image from the
database
I get a
................
An unhandled exception of type 'System.ArgumentException' occurred in
System.Drawing.dll
Additional information: ArgumentException
................
error
I have no problems reading from the the test database...just my
production
database.
SSP
Hi Alex,
That's a great example... I am however still puzzled over this portion
of
the code:
In your code below, you are pointing to an image file which is already
a
part of the project:
...................
Stream str =Sumida.bmp");
....................
In my app, I have the code as below, but when I debug, I get a Null
Refence
error:
..................
Stream str =for
an but
the
SSP said:The bmp extension doesn't work either.
SSP
Assembly.GetExecutingAssembly().GetManifestResourceStream("_signature.SignatAlex Feinman said:You cannot save the image as a gif file this way. It must have BMP extension
fromSSP said:Hi Alex,
I looked at both your examples and have tried to save the signature as an
image in the database, but it only saves a black image.
I am passing "_signature.SignatureBits" as the byte[]
---X----X----
int h = 120, w = 216;
byte [] datax = _signature.SignatureBits;
byte[] sigbitmap = CreateBitmap(w, h, datax);
MemoryStream ms = new MemoryStream(sigbitmap);
FileStream fs = new FileStream(@"\sigData.gif", FileMode.Create,
FileAccess.Write);
fs.Write(sigbitmap, 0, sigbitmap.Length);
fs.Close();
Bitmap bmp = new Bitmap(ms);
pictureBox1.Image = bmp;
---X----X----
I really need to be able to save the signature as an image or else...this
app is useless.
SSP
If you are passing a byte array to a bitmap constructor, this array is
expected to have a file format - as if you have read a valid image file
into
memory. This could be any of the supported file formats, but for your
needs
you will have to use bitmap file format. You cannot simply use the pixel
data part. The file is expected to have BITMAPFILEHEADER and BITMAPINFO
structures in the header part.
For an example of building these headers see
http://www.alexfeinman.com/download.asp?doc=OnTheFlyBitmap.zip
It in fact contains a ready-to-use function that creates a bitmap
cx,occurredcy and byte[] pixel data
It's only the signature being read as image that gives this error.
If I insert an image file, I can read it fine. If it's the signature
than,
then I get the ArgumentExecption error.
SSP
I know what the problem was for the below...Stream is an abstract
class...
I now have another problem. When I tried to read the image from the
database
I get a
................
An unhandled exception of type 'System.ArgumentException'
inSystem.Drawing.dll
Additional information: ArgumentException
................
error
I have no problems reading from the the test database...just my
production
database.
SSP
Hi Alex,
That's a great example... I am however still puzzled over this
portion
of
the code:
In your code below, you are pointing to an image file which is
already
a
part of the project:
...................
Stream str =
Assembly.GetExecutingAssembly().GetManifestResourceStream("DbAccess.River
Sumida.bmp");
....................
In my app, I have the code as below, but when I debug, I get a Null
Refence
error:
..................
Stream str =