J
James Jenkins
Hi - I am developing a database class which accesses an Access database to
simply retrieve decimal values. When I call the code below it fails with an
'
Unspecified error' - The database it calls have the 2 columns (BEGINDEC &
ENDDEC) and both are set to data type 'Double' in the database. I have also
tried this code in varying forms but always with different error messages -
what is my best option to return Double values from an Access Database -
James...
double ipdec = GetAddress(Address);
OleDbConnection conn = new OleDbConnection(@"Data
Source=GIPS.mdb;Password=;Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin");
try
{
string sql = "SELECT COUNTRY FROM GEOS WHERE BEGINDEC >= ";
sql += ipdec;
sql += " AND ENDDEC <= ";
sql += ipdec.ToString();
conn.Open();
OleDbDataAdapter adapt = new OleDbDataAdapter(sql,conn);
DataSet ds = new DataSet();
adapt.Fill(ds);
foreach(DataRow dr in ds.Tables[0].Rows)
{
Debug.WriteLine(dr["COUNTRY"]);
}catch{exception ex)Debug,Writeline(ex.Message));
simply retrieve decimal values. When I call the code below it fails with an
'
Unspecified error' - The database it calls have the 2 columns (BEGINDEC &
ENDDEC) and both are set to data type 'Double' in the database. I have also
tried this code in varying forms but always with different error messages -
what is my best option to return Double values from an Access Database -
James...
double ipdec = GetAddress(Address);
OleDbConnection conn = new OleDbConnection(@"Data
Source=GIPS.mdb;Password=;Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin");
try
{
string sql = "SELECT COUNTRY FROM GEOS WHERE BEGINDEC >= ";
sql += ipdec;
sql += " AND ENDDEC <= ";
sql += ipdec.ToString();
conn.Open();
OleDbDataAdapter adapt = new OleDbDataAdapter(sql,conn);
DataSet ds = new DataSet();
adapt.Fill(ds);
foreach(DataRow dr in ds.Tables[0].Rows)
{
Debug.WriteLine(dr["COUNTRY"]);
}catch{exception ex)Debug,Writeline(ex.Message));