我試着檢索查詢作爲一個字節數組。儘管我堅持@代碼。Retireve查詢爲字節數組
byte[] temp = QueryFile("SELECT modelFile FROM items WHERE modelName='F_Pants1'");
public byte[] QueryFile(string queue)
{
MySqlCommand command = MySqlCon.CreateCommand();
MySqlDataReader Reader;
command.CommandText = queue;
MySqlCon.Open();
Reader = command.ExecuteReader();
byte[] thisrow = new byte[1000];
while (Reader.Read())
{
for (int i = 0; i < Reader.FieldCount; i++)
thisrow[0] = Convert.ToByte(Reader.GetValue(i).ToString());
}
thisrow = thisrow.Remove(thisrow.Length - 1, 1);
MySqlCon.Close();
return thisrow;
}
如果有人有答案,我將不勝感激。
函數接受完整的sql查詢作爲字符串將導致sql注入安全問題。 –
SQL注入,如果功能將得到未覈對的字符串。 –