i have a problem with setting the value of the local variable, after i have retrieved the float value from my database. It says it is not the same type, samplerate and the value from (float)rdr["samplerate_hz"]; My code i like this.
public float hentSampleRateDOEDB(Int64 ekgmaaleid)
{
float samplerate = 0.0f;
connDOEDB.Open();
SqlCommand cmd = new SqlCommand("SELECT samplerate_hz FROM EKGDATA WHERE ekgmaaleid = '" + ekgmaaleid + "'", connDOEDB);
SqlDataReader rdr = cmd.ExecuteReader();
while(rdr.Read())
samplerate = (float)rdr["samplerate_hz"];
rdr.Close();
connDOEDB.Close();
return samplerate;
}