So I am trying to write data to a SQL directory the code is suppose to take a finger print and store it in a directory and for some reason the data in the DataRow myRow is always null I have tried everything.
sqlCommandText = "select * from xluser where xlkeyid = '" + keyId + "'";
sqlCommand.CommandText = sqlCommandText;
SqlDataReader sqlDataReader;
sqlDataReader = sqlCommand.ExecuteReader();
if (!sqlDataReader.HasRows)
Logging.LogMsg("RequestManager::HandleWriteFPData: " + clientRequest.Queue + " Failed to save fingerprint data for key id " + keyId, false);
Logging.LogMsg("RequestManager::HandleWriteFPData: " + clientRequest.Queue + " Fingerprint data saved for key id " + keyId, false);
sqlDataReader.Close();
SqlDataAdapter da = new SqlDataAdapter(sqlCommandText, sqlConnection);
MyCB = new SqlCommandBuilder(da);
DataSet ds = new DataSet("FPDATA");
da.Fill(ds, "FPDATA");
DataRow myRow;
// dmm::111907::if no rows then exception is thrown which will cancel the transaction
// which is the preferred action at this point (do not check row count)
// if ( ds.Tables["FPDATA"].Rows.Count > 0 )
myRow = ds.Tables["FPDATA"].Rows[0];
The reason I know its null is because this check returns true
if (myRow["FPDATA"] != System.DBNull.Value)