3

「データソースを空にすることはできません。メモリ内データベースを開くには:memory:を使用してください」というエラーが表示されます。

これが私の接続文字列です:

// Get Current Users App Data
            string documentsFolder = Environment.GetFolderPath
            (Environment.SpecialFolder.ApplicationData);
            string[] tempstr = documentsFolder.Split('\\');
            string tempstr1 = "";
            documentsFolder += "\\Google\\Chrome\\User Data\\Default\\History";
            if (tempstr[tempstr.Length - 1] != "Local")
            {
                for (int i = 0; i < tempstr.Length - 1; i++)
                {
                    tempstr1 += tempstr[i] + "\\";
                }
                documentsFolder = tempstr1 + "Local\\Google\\Chrome\\User Data\\Default\\History";
            }

            // Check if directory exists
            if (Directory.Exists(documentsFolder))
            {
            //    return ExtractUserHistory(documentsFolder);

            }

            string connectionString;
            connectionString = string.Format(@"DataSource={0}", documentsFolder);

そして、これが私のつながりです:

    SQLiteConnection conn = new SQLiteConnection(connectionString);
    conn.Open();

助けてくれてありがとう。

4

1 に答える 1

6

このエラーは、接続文字列が間違っている場合に発生します。

@"Data Source={0}" DataSource の代わりに Data Source を配置する必要があります

それが役に立てば幸い。

于 2012-06-28T12:19:55.200 に答える