473,387 Members | 1,757 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

parameter query in MDB

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?


Nov 19 '05 #1
1 1646
Let the microsoft access code generator write the code for you.

http://www.eggheadcafe.com/articles/..._generator.asp

--
2005 Microsoft MVP C#
Robbe Morris
http://www.robbemorris.com
http://www.learncsharp.net/home/listings.aspx

"Msnews" <da******@adelphia.net> wrote in message
news:OX****************@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?

Nov 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: WGW | last post by:
Though I am a novice to MS SQL server (2000 I believe), I can do almost! everything I need. Maybe not efficiently, but usefully. However, I have a problem -- a complex query problem... I can...
5
by: MX1 | last post by:
Simpler way to ask question from my previous post. I wrote a query and it has a paramter field in it. I want to enter a date with the current year. If it I put in 6/30/2003, it works great. If I...
3
by: thomas goodwin | last post by:
I have a query which asks for a parameter value to execute it. To see the results I have to: a) click on the query -- the "Enter Parameter Value" window pops up. b) enter the parameter value c)...
3
by: cassandra.flowers | last post by:
Hi, I was wondering if it is possible (Using access) to have a query parameter as a drop down box rather than a text box? e.g. typing as criteria for a query produces a box with a text box...
4
by: Andy Davis | last post by:
I have developed a number of reports that are based on parameter queries where the user enters criteria such as a date range and a sales rep say. I want to be able to show a graphical picture in...
1
by: carrionk | last post by:
Hi, I have created a Subform which SourceObject is a parameter query. This is the Query: Qry Name:80IsscomProduct SELECT * FROM Isscomp28 WHERE Like ;
21
by: Marc DVer | last post by:
I am trying to create a query that can be loaded as a querydef object but not having to assign values to the parameters if I don't want to. Normally when using a parameter query in VBA my code...
6
by: tizmagik | last post by:
I am having a lot of difficulty generating a CrossTab Query based report. I have looked online for several tutorials and whatnot but I have not been able to really find what I'm looking for, nor...
2
by: billtubbs | last post by:
Hi I am getting the common problem of the "Enter Parameter Value" dialog box, which pops up every time I execute a query. I built the query using the Expression Builder in Access. If any of my...
20
by: exipnakias | last post by:
Hello Guys. In a form I created a listbox which looks up the values of a table. I want: 1) ..to create a query where a parameter will be needed in order to be loaded. But I do not want to...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.