简体   繁体   English

SQLite + Visual Studio 2013 Express-设计时支持问题

[英]SQLite + Visual Studio 2013 Express - design-time Support issue

I am trying to decide if I can use Visual C# 2013 Express Edition with SQLite for a project that I am going to be working on. 我试图确定我是否可以将Visual C#2013 Express Edition与SQLite一起用于要进行的项目。 On the SQLite page it says: SQLite页面上显示:

Visual Studio design-time Support, works with all versions of Visual Studio 2005/2008/2010/2012/2013. Visual Studio设计时支持可与所有版本的Visual Studio 2005/2008/2010/2012/2013一起使用。 You can add a SQLite database to the Servers list, design queries with the Query Designer, drag-and-drop tables onto a Typed DataSet, etc. Due to Visual Studio licensing restrictions, the Express Editions can no longer be supported. 您可以将SQLite数据库添加到“服务器”列表中,使用查询设计器设计查询,将表拖放到Typed DataSet上,等等。由于Visual Studio许可限制,不再支持Express Edition。

What does this mean exactly? 这到底是什么意思? Does it just mean that I cannot 'drag and drop' control onto the Windows Form? 这是否仅意味着我无法将控件“拖放”到Windows窗体上? Shouldn't I be able to reference this Assembly in my code and just work with it? 我不应该能够在我的代码中引用此Assembly并对其进行处理吗? Are there any other issues that this implies? 这还意味着其他问题吗?

Sorry for being late with the answer, maybe it'll help others though. 抱歉,答案迟到了,虽然它可能会对其他人有所帮助。

Yes this means you only will be able to access SQLite db from your code not from IDE: you wont be able to connect to it from the Database Explorer etc. So it will be impossible to auto-generate a typed dataset or linq context. 是的,这意味着您将只能从代码中访问SQLite db,而不能从IDE中访问SQLite db:您将无法从数据库资源管理器等连接到SQLite db。因此,将无法自动生成类型化的数据集或linq上下文。 So you'll have to do that manually or use an old-shool approach of creating a connection and command objects, passing a query as a string etc. 因此,您将必须手动执行此操作,或使用旧的创建连接和命令对象,将查询作为字符串传递等方法。

    var conn = new SQLiteConnection("data source=db");
    conn.Open();
    using (SQLiteCommand cmd = conn.CreateCommand())
    {
        cmd.CommandText = "select * from customers";
        var rdr = cmd.ExecuteReader();
        while (rdr.Read())
        {
            MessageBox.Show(rdr["name"].ToString());
        }

    }

ps: you'd better download an appropriate nuget package by rightclicking References in the Solution Explorer than get assemblies from the sqlite site. ps:与从sqlite站点获取程序集相比,最好通过在解决方案资源管理器中右键单击“参考”来下载适当的nuget程序包。 much easier. 容易得多。

pps: to manage db structure i use SQLite2009 Pro, its free and quite handy. pps:要管理数据库结构,我使用SQLite2009 Pro,它免费且方便。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM