locked
MS Access & C# RRS feed

  • Question

  • User893424065 posted

     hello until 3 day i working one problem and cant resolved

    i have one access mdb file. 1 table and 3 functions in module. when i run this query in access everythink is good and working

    SELECT *, ((60*Degrees((ACos((Sin(Radians(40.128056))*Sin(Radians([airports].lat)))+(Cos(Radians(40.128056))*Cos(Radians([airports].[lat]))*Cos(Radians([airports].[lon]-32.995)))))))) AS Distance FROM airports

     

    after i want to send this query from c# but givin this error undefined function Degrees i using OleDb i think i cannot access function from oledb 

     

    string SqlString = " SELECT *, ((60*Degrees((ACos((Sin(Radians(40.128056))*Sin(Radians([airports].lat)))+(Cos(Radians(40.128056))*Cos(Radians([airports].[lat]))*Cos(Radians([airports].[lon]-32.995)))))))) AS Distance FROM airports;";
    OleDbCommand cmd = new OleDbCommand(SqlString, cnn);
    OleDbDataReader drReader;
    drReader = cmd.ExecuteReader();

    please help me 

    Saturday, January 24, 2009 6:22 PM

Answers

  • User-1199946673 posted

    after i want to send this query from c# but givin this error undefined function Degrees i using OleDb i think i cannot access function from oledb 

    Correct, you cannot use self created functions in Modules in ASP.NET So you'll have to get the fields that you need for the calculation form the table, and then do the calculation in C#

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, January 24, 2009 8:04 PM