如果有MySql
asp
表,如果它的单元格有值或没有值,我只是徘徊。
如果数据库在那里有行/记录,我用这将返回
string ConnectionString = @"Server=MYSQL5011.Smarterasp.net;Database=db_9d6c52_ahmed;Uid=9d6c52_ahmed;Pwd=******;";
MySqlConnection GetConnection = new MySqlConnection(ConnectionString);
GetConnection.Open();
string VoiceorScreenSearch = "Select User_Voice ,User_Screen From User where User_Stat=@UserStat";
MySqlCommand Comand = new MySqlCommand(VoiceorScreenSearch, GetConnection);
Comand.Parameters.AddWithValue(@"UserStat", key);
MySqlDataReader ReadData = Comand.ExecuteReader();
if (ReadData.HasRows)
{
hasrowsornot = true;
}
但如果Cell[1]
为null
或有数据,我需要它返回!我的单元格数据类型为BLOB
这样做的提示? ,会有所帮助 谢谢
答案 0 :(得分:0)
您可以尝试这样:
if (!ReadData.IsDbNull(yourfield)) {
var value = ReadData.GetString(yourfield);
// some code
}