用于VB.NET的SQLite PCL,如何查询?

时间:2015-09-15 09:26:06

标签: vb.net sqlite

我已经看到在C#中使用的许多例子来查询使用属性来引用表映射。这在Visual Basic中不起作用。有谁知道如何查询SQLite数据库?

此处示例:SQLite net PCL - Simple select

下面的代码是我所拥有的一个例子,但这不起作用

custs = db.Query(lcCust)("SELECT lcCust.* FROM lcCust")

1 个答案:

答案 0 :(得分:0)

这是原始的C#

class MyTableName
{
    public string lastname { get; set; }
    public string firstname { get; set; }
}

var list = db.Query<MyTableName>("select * from MyTableName");
var list = db.Query<MyTableName>("select * from MyTableName where lastname=? and firstname=?", lastnameValue, firstNameValue);

并翻译成VB.net

Class MyTableName
{
    Public Property lastname As String
    Public Property firstname As String
}
Dim list = db.Query(Of MyTableName)("select * from MyTableName")
Dim list = db.Query(Of MyTableName)("select * from MyTableName where lastname=? and firstname=?", lastnameValue, firstNameValue)