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([@dotnet.itags.org.LAT1],[@dotnet.itags.org.LON1],tblPrimary.Lat,tblPrimary.Lon) AS dist1
FROM tblPrimary
WHERE Zip Like [@dotnet.itags.org.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("@dotnet.itags.org.LAT1",OleDbType.Double,8));
myparm.Direction = System.Data.ParameterDirection.Input;
myparm.Value = lat1;
myparm = sql1.Parameters.Add(new
OleDbParameter("@dotnet.itags.org.LON1",OleDbType.Double,8));
myparm.Direction = System.Data.ParameterDirection.Input;
myparm.Value = long1;
myparm = sql1.Parameters.Add(new OleDbParameter("@dotnet.itags.org.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?Let the microsoft access code generator write the code for you.
Robbe Morris
[url]http://www.robbemorris.com" target="_blank">http://www.eggheadcafe.com/articles...robbemorris.com
http://www.learncsharp.net/home/listings.aspx
"Msnews" <daveberg@.adelphia.net> wrote in message
news:OXx7%23BALFHA.1136@.TK2MSFTNGP10.phx.gbl...
>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?
>
>
Friday, March 16, 2012
parameter query in MDB
Labels:
accesses,
asp,
file,
functiongeo_distance,
input,
mdb,
net,
parameter,
parameters,
parms,
qryziplike,
query,
requires,
select
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment