小编Ben*_*Ben的帖子

SQLite PRAGMA table_info(表)不返回列名(在C#中使用Data.SQLite)

我使用以下示例代码,并希望以某种方式获取sqlite3数据库的列名称:

using System;
using System.Data.SQLite;
namespace Program
{
class Program
{
    static void Main(string[] args)
    {
        Program stuff = new Program();
        stuff.DoStuff();
        Console.Read();
    }
    private void DoStuff()
    {
        SQLiteConnection.CreateFile("Database.sqlite");
        SQLiteConnection con = new SQLiteConnection("Data Source=Database.sqlite;Version=3;");
        con.Open();
        string sql = "create table 'member' ('account_id' text not null unique, 'account_name' text not null);";
        SQLiteCommand command = new SQLiteCommand(sql, con);
        command.ExecuteNonQuery();
        sql = "insert into member ('account_id', 'account_name') values ('0', '1');";
        command = new SQLiteCommand(sql, con);
        sql = "PRAGMA table_info('member');";
        command = new …
Run Code Online (Sandbox Code Playgroud)

c# sqlite

0
推荐指数
2
解决办法
1万
查看次数

标签 统计

c# ×1

sqlite ×1