Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
399 views
in Technique[技术] by (71.8m points)

android - 将Xamarin与数据库文件连接(connect xamarin with database file)

i'm trying to connect with exesting sqlite database with Xamarin application

(我正在尝试使用Xamarin应用程序连接大量的sqlite数据库)

 var gridview1 = FindViewById<GridView>(Resource.Id.gvd);
            var adapter = new ArrayAdapter<string>(this, Android.Resource.Layout.SimpleExpandableListItem1);
            string path = Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "dvp.db");
            SqliteConnection con = new SqliteConnection(path);    
            SqliteCommand cmd = new SqliteCommand("select pays from tvp");
            con.Open();
            cmd.Connection = con;
            SqliteDataReader sqlreader = cmd.ExecuteReader();
            while (sqlreader.Read())
            {

                adapter.Add((string)sqlreader[0]);
            }
            sqlreader.Close();
            con.Close();

the error is :

(错误是:)

System.ArgumentException: Invalid ConnectionString format for parameter "/data/user/0/App1.App1/files/dvp.db"

please if any one know where i have to place my database file or any other solution , help me and thanks :)

(如果有人知道我必须在哪里放置数据库文件或任何其他解决方案,请帮助我,谢谢:))

  ask by P?liranté ?êll? translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...