I try reading data from SQL Server 2005 and filling it in a TableAdapter (also tried to user DataReader) but I keep getting this exception. The thing is that I get this error on some systems, that is I run my application peacfully on a system but on another system I get this exception.
The Code is:
public DataSetRef GetReportPumpControl(PumpInfo pump, DateTime start, DateTime end)
{
if (!OpenConnection())
return null;
m_Command.CommandText = "SELECT ref_dig_pumpcontrol, ref_energy, ref_datetime FROM [molisoftSchema].[Refresh] WHERE ref_pump_id = " + pump.ID + " AND ref_datetime BETWEEN '" + start + "' AND '" + end + "' ORDER BY ref_datetime ASC";
SqlDataAdapter adapter = new SqlDataAdapter(m_Command);
DataSetRef ds = new DataSetRef();
adapter.Fill(ds, "RefreshPC");
return ds;
/*m_Reader = m_Command.ExecuteReader();
LinkedList<PumpControlInfo> returnValue = new LinkedList<PumpControlInfo>();
while (m_Reader.Read())
{
PumpControlInfo tempControl = new PumpControlInfo();
tempControl.DateTime = (DateTime)m_Reader["ref_datetime"];
tempControl.Energy = (double)m_Reader["ref_energy"];
tempControl.PumpControl = (bool)m_Reader["ref_dig_pumpcontrol"];
returnValue.AddLast(tempControl);
}
m_Reader.Close();
return returnValue.ToArray<PumpControlInfo>();*/
}
Please help me with this matter. Thanks in advance!