Store it on the file system and refer to the name in the database?

images in databases are generally a bad idea.

On Tue, Apr 17, 2012 at 16:01, chris.s <[email protected]> wrote:
> I'm struggling trying to work out how to insert an image into a sqlite db.
>
> So far I've got this...
>
> UIImage img =......
> NSData data = img.AsPng();
> using (var command = new SqliteCommand())
> {
>  command.Connection = ....
>  command.CommandText = "insert into imagetable (iref, myimage) values (1,
> @imagedata)";
>  command.Parameters.AddWithValue("@imagedata", data);
>
> //  also tried this....
> //  command.Parameters.Add("@imagedata");
> //  command.Parameters[0].Size = (int)data.Length;
> //   command.Parameters[0].Value = data;
>
>  command.ExecuteScalar();
> }
>
> Gives me an exception..
>
> "Argument cannot be null.\Parameter name: s"
>
> The column is defined as an 'Image' datatype .. "create table
> imagetable(iref int, myimage image)"
>
> "data" is definitely not null and the db connection is all fine.
>
> Suggestions?
>
> Chris
>
> --
> View this message in context: 
> http://monotouch.2284126.n4.nabble.com/Inserting-image-into-SQLite-tp4565016p4565016.html
> Sent from the MonoTouch mailing list archive at Nabble.com.
> _______________________________________________
> MonoTouch mailing list
> [email protected]
> http://lists.ximian.com/mailman/listinfo/monotouch



-- 
Nic Wise
t.  +44 7788 592 806 | @fastchicken | http://www.linkedin.com/in/nicwise
b. http://www.fastchicken.co.nz/

Earnest: Self-employed? Track your business expenses and income.
http://earnestapp.com
Nearest Bus: find when the next bus is coming to your stop. http://goo.gl/Vcz1p
mobileAgent (for FreeAgent): get your accounts in your pocket.
http://goo.gl/IuBU
Trip Wallet: Keep track of your budget on the go: http://goo.gl/ePhKa
London Bike App: Find the nearest Boris Bike, and get riding! http://goo.gl/Icp2
_______________________________________________
MonoTouch mailing list
[email protected]
http://lists.ximian.com/mailman/listinfo/monotouch

Reply via email to