2015-09-28 90 views
1

我只是徘徊,如果有檢查MySqlasp表,如果其單元格有值或不是。檢查MySql中的空單元格表

心中已經使用這回如果數據庫具有行/記錄有

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 [email protected]"; 
      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

你可以嘗試這樣的:

if (!ReadData.IsDbNull(yourfield)) { 
    var value = ReadData.GetString(yourfield); 
    // some code 
} 
+0

我應該寫我的字段名或我的場數? –