Store an image in a SQL Server CE database C# Compact framework code -


After the

Hello I ..

Enter the database SQL id image using my code C # Compact Framework Want

  fileinfofifo = new fileinfo (open fileDialog1 .filname .tating ()); Long LNGLang = 5; FileStream FSTRM = New Filestream (OpenFileDialog 1.FilenameTooling ()); BinaryReader br = new binary reader (Fstrm); Byte [] data = br.ReadBytes (int) lngLenght); String Query = "Insert In Category (cm_id, cm_intage) value (@ id, @ img)"; Sqlcecommand cmd = new sqlcecommand (query, cls.Connect ()); Cmd.parameters.add (new sqlcparameter ("@ id", (object) textbox1.text); cmd.parameters.add (new sqlcparameter ("@ id", (object) data); cmd.executenonquery ();   

but showing this error .... openfiledialog1, file not found ....

My load image code

  openfiledialog Open = new opendailog (); open.filter = "image files (* JPG * bmp; |. * .jpg; * bmp, if (open.showdilog () == dialogresult.Ok) {pitcherbox1.image = new bitmap ( Open file file; fileinfo;}    

fileInfo Filfo = new FileInfo (OpenFileDialog1 FileName ToSting (); Long LngLength = 5; FileStream fstrm = New FileStream (OpenFileDialog1.FileName.To Sting ()); BinaryReader br = new BinaryReader (Fstrm); Byte [] data = br.ReadBytes (int) lngLenght;); String query = "insert in category (cm_id, cm_image) values ​​(@ id, @ img)"; Sqlcecommand cmd = new sqlcecommand (query, cls.Connect ()); cmd.parameters.add (new sqlcparameter ("@ id", (object) textbox1.text); Cmd.parameters.add (new sqlcparameter ("@ img", (object data); c md.executenonquery ();

Comments