Search code examples
sqlitewindows-store-apps

store and display image in sqlite in windows store app?


I have a form from which I want to store an image to my sqlite database and then i want it to be displayed at another page as grid background. I am making an windows store app so I am using xaml and c#. I want the stored image as my gridview background.


Solution

  • You can store your Image to database with 2 ways-

    1. By converting image to byte[]
      1. convert Image to bytes[] and save it to sqlite Blob type parameter.
      2. get that Blob datatype and store again to byte[] and then convert to Image
    2. By converting image to base64 string
      1. Convert image to base64 string store to sqlite in varchar/varchar2 type
      2. get base64 string from sqlite db and convert to image