我正在尝试选择字段= Title
包含相同关键字的行。我的表有2行,Title
字段是 Sweet Country 和 Sweet Country 2 。我进行查询,然后在其Sweet
字段中选择包含Title
的行。
我将第一行的数据存储在列表中,但是我不知道如何使用MySqlDataReader将光标更改为第二条记录!
这是我的代码:
DB.dbConnection.Open();
MySqlCommand cmd = new MySqlCommand("select * from Movies where Title LIKE '%" + searchKeyword + "%'",DB.dbConnection);
DB.dataReader = cmd.ExecuteReader();
while (DB.dataReader.Read())
{
baseResponse.response = true;
baseResponse.search.Add(new Movie.Item
{
title = DB.dataReader.GetString(1),
year = DB.dataReader.GetString(2),
released = DB.dataReader.GetString(3),
runTime = DB.dataReader.GetString(4),
genre = DB.dataReader.GetString(5),
director = DB.dataReader.GetString(6),
writer = DB.dataReader.GetString(7),
actors = DB.dataReader.GetString(8),
language = DB.dataReader.GetString(9),
country = DB.dataReader.GetString(10),
awards = DB.dataReader.GetString(11),
poster = DB.dataReader.GetString(12),
imdbScore = DB.dataReader.GetString(13),
production = DB.dataReader.GetString(14),
dl480p = DB.dataReader.GetString(15),
dl720p = DB.dataReader.GetString(16),
dl1080p = DB.dataReader.GetString(17),
subtitleLink = DB.dataReader.GetString(18),
dubLink = DB.dataReader.GetString(19),
description = DB.dataReader.GetString(20),
state = DB.dataReader.GetString(21),
});
}
此脚本仅读取第一条记录!如何获得查询返回的第二条记录?!