Connect to SQLite located in Android's Xamarin Forms Resource

JassimRahmaJassimRahma USMember ✭✭✭

Hi,

I have this class to connect to SQLite...

using System;
using SQLite;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using Xamarin.Forms;

namespace ConvertAny.Database
{
    public class ConvertAnyResourceDatabase
    {
        public SQLite.SQLiteConnection connection { get; }
        public static string resource { get; set; } = string.Empty;

        public ConvertAnyResourceDatabase()
        {
            connection = new SQLiteConnection(resource);
        }
    }
}

My db3 is available in Resource.Raw.ConvertAny

How can I pass that that in a ConvertAnyResourceDatabase.resource static so it will connect.

I tried:

ConvertAnyResourceDatabase.resource = Resource.Raw.ConvertAny.ToString();

but it's failing.

Kindly help..

Thanks,
Jassim

Sign In or Register to comment.