parameter query in MDB

M

Msnews

I have this query (qryZipLike) in an MDB file. It accesses a function
geo_distance() and requires input parms for the three parameters.

SELECT tblPrimary.Zip, tblPrimary.State, tblPrimary.City,
geo_distance([@LAT1],[@LON1],tblPrimary.Lat,tblPrimary.Lon) AS dist1
FROM tblPrimary
WHERE Zip Like [@P1];

I am trying to access this query from C# in asp.net using ado.net. I am
really not sure how to do so, but have tried the following code.

OleDbCommand sql1 = new OleDbCommand("qryLikeZip", oleDbConnection1);
theSQL = "SELECT City,Zip,dist1 FROM qryZipLike";

sql1.CommandText = theSQL;
OleDbParameter myparm;

myparm = sql1.Parameters.Add(new
OleDbParameter("@LAT1",OleDbType.Double,8));
myparm.Direction = System.Data.ParameterDirection.Input;
myparm.Value = lat1;

myparm = sql1.Parameters.Add(new
OleDbParameter("@LON1",OleDbType.Double,8));
myparm.Direction = System.Data.ParameterDirection.Input;
myparm.Value = long1;

myparm = sql1.Parameters.Add(new OleDbParameter("@P1",OleDbType.VarChar,4));
myparm.Direction = System.Data.ParameterDirection.Input;
myparm.Value = "030*";

dr = sql1.ExecuteReader();



I get this error at the ExecuteReader call...

Undefined function 'geo_distance' in expression

Can anyone help me with this?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top