Home >Database >Mysql Tutorial >mysql-c#为什么老出现无法将QQmanagerDB.Item隐式转换为system.Array

mysql-c#为什么老出现无法将QQmanagerDB.Item隐式转换为system.Array

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-06 09:45:511035browse

mysql.netc#编码错误

CSDN移动问答

CSDN移动问答

public Array[] GetAll(string sql)
{
Array[] arr = new Array[100];
int i = 0;
try
{
SqlCommand command = new SqlCommand(sql,db.conn);
db.Open();
SqlDataReader reader = command.ExecuteReader();
while (reader.Read())
{
Item it = new Item();
it.ID = Convert.ToInt32(reader["ID"]);
it.Name = (reader["Name"]).ToString();
it.Level = (reader["Level"]).ToString();
it.Email = (reader["Email"]).ToString();
it.days = Convert.ToDouble(reader["days"]);
arr[i] = it;
i++;
}
}

page:

case 1:

<code>                    string sql = "select * from Users";                    Array[] arr = man.GetAll(sql);                    Console.WriteLine("----------------------------------------------------------");                    Console.WriteLine("编号\t昵称\t等级\t天数\t邮箱");                    Console.WriteLine("----------------------------------------------------------");                    foreach (Array item in arr)                    {                        if (item != null)                        {                            Console.WriteLine("{0}\t{1}\t{2}\t{3}\t{4}");                        }                        else                        {                           break;                           }                        Console.WriteLine("----------------------------------------------------------");                    }                    break;</code>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn