473,395 Members | 1,791 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,395 software developers and data experts.

Problems with MOD-Function by accessing MS-Access Database via SQL in Delphi

Hello,
the following problem:

I use Delphi 6 to access a MS Access Database.
In short, the Delphi Code looks like this:
ADOConnection1.Open;
ADOQuery1.Close;
ADOQuery1.SQL.Text := 'SELECT * FROM database1 WHERE
value1=1 AND value2= ' + inttostr(array[3]);
ADOQuery1.Open;
Label5.Caption:=ADOQuery1.Fiel*dByName('value4').A sString;
Now I only want to select these rows, where the Integer value3 ends on
1. So I need the Modulo-Function. I found in the Internet these two
functions:
MOD(x,y) und x % y
But I get an error if I want to use one.

For example, If I change
ADOQuery1.SQL.Text := 'SELECT * FROM database1 WHERE
value1=1 AND value2= ' + inttostr(array[3])+' AND MOD(value3,10) = 1;
Delphi shows me a Syntax Error in this statement.

Thx for help!

Aug 23 '05 #1
2 5827
Sorry, there is a ' missing in the code. But it has nothin to do with
the problem:

The first code runs perfectly, but If I insert
AND MOD(20,10) = 0 there is the syntax error again.

Aug 23 '05 #2
On 23 Aug 2005 11:51:15 -0700, sarah18web wrote:
Sorry, there is a ' missing in the code. But it has nothin to do with
the problem:

The first code runs perfectly, but If I insert
AND MOD(20,10) = 0 there is the syntax error again.


Don't know what it might have to do with Delphi; but MOD() is not a
function supported by SQL server. Only the % operator works.
Aug 23 '05 #3

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

Similar topics

5
by: Griff | last post by:
Test program: =============================================================== t = 5.8 interval = 2.0 while t < 6.1: print "%s mod %s = %s " % (t, interval, t % interval ) t += 0.1...
3
by: Peter Rohleder | last post by:
Hi, I'm using a style-sheet where I make use of the XPATH-"following-sibling"-expression. The part which makes problems looks similar to the following code: --------------------------- ...
7
by: sbobrows | last post by:
{Whilst I think much of this is OT for this newsgroup, I think the issue of understanding diagnostics just about gets under the door. -mod} Hi, I'm a C++ newbie trying to use the Boost regex...
7
by: Jo | last post by:
Hi Guys! I'm sorry for my stupid question. I want to use the operator "mod" (perhaps mod is pascal and not c++) to calculate the rest of a division, to separate the odd and even number of...
4
by: Diogo Alves - Software Developer | last post by:
I have the following code line: dsEmps.Tables.Columns.Expression = "MonthlyDeviation%60"; but hits gives an error it says that can't MOD from System.Double to System.Int32 I tried to put the...
4
by: David | last post by:
I have a problem that just cropped up with using an ImageList in my project I am using VB .NET 200 Problem: I have existing Form with 2 Image List controls. ImageList16 (for 16x16 Images) and...
3
by: Michael C# | last post by:
A statement of the form (m mod n) uses the sign of the first operand (m) as the sign of the result. I've ecnountered an issue where I need it to use the sign of the second operand. Here's what it...
0
by: pdorn | last post by:
Hi: I have been trying to create an eight deck card "shoe" (as used in casino games such as Blackjack and Baccarat), but have run into some problems. I do not have much programming experience, and so...
1
by: Prashant Bhangre | last post by:
Hello, I am very new to Python. I am writing a script to ListSMS for my Telit GE863GPS Module. I have Python1.5.2. on Window XP. I am getting an error when i run the script. Here is the whole...
1
Mod
by: RN1 | last post by:
79 Mod 92 evaluates to 79 156 Mod 249 evaluates to 156 So while using the Mod operator, if the first number is less than the second number, will the result be ALWAYS EQUAL to the first number?
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.