【发布时间】:2017-05-13 19:09:11
【问题描述】:
我有一些数据存储在 SQLite 数据库中,我想在 C# 网页上显示这些数据。我搜索了正确的方法,但只找到了 console.writeline,而且 SqliteDataReader 函数不起作用。这是我的代码:
protected void Page_Load(object sender, EventArgs e)
{
using (System.Data.SQLite.SQLiteConnection conn = new System.Data.SQLite.SQLiteConnection("Data Source=C:/Users/elias/Documents/Visual Studio 2017/WebSites/WebSite7/App_Data/overhoren.db"))
{
using (System.Data.SQLite.SQLiteCommand command = new System.Data.SQLite.SQLiteCommand(conn))
{
conn.Open();
command.Connection = conn;
SQLiteDataReader reader = command.ExecuteReader();
while (reader.Read())
string test = ("Name: " + reader["name"] + "\tScore: " + reader["score"]);
command.ExecuteNonQuery();
conn.Close();
}
}
我该怎么办?
提前致谢,
埃利亚斯
【问题讨论】:
-
您的查询是什么? IE。你必须把
command.CommandText = "...";
标签: c# html mysql database sqlite