DateTime Query in Ultralite

Hi I am using Palm Object Library for my application how to
query the ultralite db with DateTime in the WHere Clause.
The query i use is like

EXEC SELECT * FROM ABC WHERE STARTTIME = :mytime

here mytime is a host variable whose variable will be
changing as per user enteres. If i use mytime as CDatetime
type or CString as host variable type i get -157 error (type
conversion error)

Are there any exapmles or sample using this type of DateTime
query
0
Bass
2/13/2004 2:12:21 PM
sybase.sqlanywhere.ultralite 2982 articles. 0 followers. Follow

3 Replies
716 Views

Similar Articles

[PageSpeed] 59

Bass wrote in news:402cddd9.661b.846930886@sybase.com:

B> Hi I am using Palm Object Library for my application how to
B> query the ultralite db with DateTime in the WHere Clause.
B> The query i use is like
B> 
B> EXEC SELECT * FROM ABC WHERE STARTTIME = :mytime
B> 
B> here mytime is a host variable whose variable will be
B> changing as per user enteres. If i use mytime as CDatetime
B> type or CString as host variable type i get -157 error (type
B> conversion error)

In this past, I used the Palm API to format the date I want into YMD
format, since that is what ASA/UL is expecting.

If you show more of your code, we can offer other suggestions, I dont
have a sample of this handy.
-- 
David Fishburn
NEW - Certified ASA Developer Version 8
iAnywhere Solutions - Sybase 
Professional Services
Please only post to the newsgroup
Please ALWAYS include version and MORE importantly BUILD number with 
EACH post (dbeng9 -v).

EBFs and Maintenance Releases
http://downloads.sybase.com/swx/sdmain.stm 

Developer Community / Whitepapers
http://www.ianywhere.com/developer

CaseXpress - to report bugs
http://casexpress.sybase.com

CodeXchange - Free samples
http://ianywhere.codexchange.sybase.com/servlets/ProjectDocumentList

0
David
2/13/2004 4:51:21 PM
Hi Thaks for your reply.

THe code segement is as show below
EXEC SQL BEGIN DECLARE SECTION;
 DATETIME m_Date; //tried array of TCHAR
EXEC SQL END DECLARE SECTION;

class CustomerManager
{
CDateTime m_Date; //tried CString, array of Chars
}


long CustomerManager::GetCallCount()
{
EXEC SQL SELECT count( * )
	INTO :m_CustomerCount
	FROM CUSTOMER
	WHERE DATEFORMAT(START_TIME,'dd-mm-yyyy') =
DATEFORMAT(m_Date,'dd-mm-yyyy');

}

I set the m_Date in another fuction and it is set correctly
as i have seen the values in debug mode.

There are no compile time error but the SQLcode returned is
-157 (SQLE_CONVERSION_ERROR )
0
Bass
2/16/2004 6:21:14 AM
In the docs, see "UltraLite C/C++ User's Guide/Developing Applications Using
Embedded SQL/Using host variables/Data types in embedded SQL".  There's an
example of using a datetime column type.

Basically, you want something like:

EXEC SQL BEGIN DECLARE SECTION;
DECL_DATETIME    m_Date;
EXEC SQL END DECLARE SECTION;

EXEC SQL SELECT count(*) INTO :m_CustomerCount
  FROM CUSTOMER WHERE START_TIME = :m_Date;


Paul

<Bass> wrote in message news:4030615a.2056.846930886@sybase.com...
> Hi Thaks for your reply.
>
> THe code segement is as show below
> EXEC SQL BEGIN DECLARE SECTION;
>  DATETIME m_Date; //tried array of TCHAR
> EXEC SQL END DECLARE SECTION;
>
> class CustomerManager
> {
> CDateTime m_Date; //tried CString, array of Chars
> }
>
>
> long CustomerManager::GetCallCount()
> {
> EXEC SQL SELECT count( * )
> INTO :m_CustomerCount
> FROM CUSTOMER
> WHERE DATEFORMAT(START_TIME,'dd-mm-yyyy') =
> DATEFORMAT(m_Date,'dd-mm-yyyy');
>
> }
>
> I set the m_Date in another fuction and it is set correctly
> as i have seen the values in debug mode.
>
> There are no compile time error but the SQLcode returned is
> -157 (SQLE_CONVERSION_ERROR )


0
Paul
2/18/2004 3:41:01 PM
Reply:

Similar Artilces:

Ultralite Query Help
I am using ASA v 8.0.2.4285 and I am developing for Palm. I am creating a filter in place that allows the user to filter the resulting list based on 3 criteria. Each of the 3 criteria has a "Select All" option and several other options. When "Select All" is chosen this effectivly removes this criteria from the query. I am trying to devise the most efficient way to write my ESQL. Te Start with: EXEC SQL DECLARE MyCursor CURSOR FOR SELECT * from MyTable where criteria1 = c1 and criteria2 = c2 and criteria3 = c3; This works if all three selections are mad...

about ultralite
Dear All, Can i develop a ultralite program not using sybase asa database, can i using sql server or oracle directly.. Regards, Hans Hello, > Can i develop a ultralite program not using sybase asa database, > can i using sql server or oracle directly.. I think, you need asa just as a reference database, used by UltraLite, generating the source files etc. But with a working UltraLite application, which has a similar schema like your database (MSSQL, ORA etc.), you can use the MobiLink server to synchronize with. -- Best Regards, Tamas Beri mailto:tamas.beri@leadsys.h...

About UltraLite
Dear sirs, I want to gather some information about UltraLite from these forum. 1) What tools or language can develop a UltraLite application? 2) Can you tell me the size of a general UltraLite application? 3) How to calculate the licences fee of a UltraLite database engine and the application? Please help! Thanks in advance, Bill Lui E-mail : luichiming@hotmail.com >1) What tools or language can develop a UltraLite application? UltraLite supports C/C++ and Java. If you are developing for WinCE then the supported compiler is Visual C. If you are developing for t...

Ultralite
Is it possible, by any means to open an .udb file from powerbuilder 10.2 either programmatically or from the database painter??? Maybe installing some kind of drivers as an example.. Thanks in advance, Chris ...

Ultralite Project query
Hi - I need to add a Sybase statement to the Ultralite project that reads - SELECT Name FROM Table WHERE Name LIKE '%abc%' where abc needs to be passed in at runtime in the placeholder ?. Can the above query be entered as: SELECT Name FROM Table WHERE Name LIKE '%?%' Will this work? Please help me, Thanks, preeti preeti wrote in news:22498C8C06CE1580005ED1EB85256CC6.005ED1FB85256CC6 @webforums: > SELECT Name FROM Table WHERE Name LIKE '%?%' No, I think you would do this: SELECT Name FROM Table WHERE Name LIKE ? Then when y...

How to set value of datetime in ultralite?
My platform is MobileBuilder 2.0.933 + PalmOS 3.5 + ASA 7.0.1.1176. I try to use ULBSetDateTime(ULDatabaseDBtohost, toclient_create_date, &datetime) to set the value of a table column. But I can't pass the compilation. The 3rd parameter is not correct. I tried other types but failed. Could someone give me an advice? Thank you for your help Weigang. Show us how you declared each of the 3 parameters that you used. -- David Fishburn Certified SQL Anywhere Associate Sybase - iAnywhere Solutions Professional Services Please only post to the newsgroup EBFs h...

Wrong Ultralite query results!
There seems to be a problem getting right results from a query in Ultralite DB on WinCE. V 7.0.2 Following statement works fine in the Windows emulation environment but not on the WinCE ARM target! SELECT * from customer WHERE name LIKE ? ( name is a char[20] ) For the ? we set 'S%'. After opening the query and trying to get through the results with Next() the Ultralite Library throughs an exception ( I do not know which one ) and skips the following code! The same code is working with a numerical field like: SELECT * from customer WHERE number LIKE ? (...

Running MobileVB Ultralite 8 application in Windows after installing Ultralite 9
I have 3 applications. I developed my first 2 using Ultralite 8 technology. For my 3rd, I installed Ultralite 9 so I could use use dynamicSQL. In MobileVB, under Project,References, I can see both "iAnywhere Solutions Ultralite for MobileVB 8" and "iAnywhere Solutions Ultralite for MobileVB 9". So everything is installed correctly. When I want to run my 1st or 2nd application in Windows(using db connection techniques for UL 8), I can't run the app. I get errors because it wants me to use the UltraLite 9 database connection syntax. I do not understand...

A problem about Datetime format between Oracle with UltraLite
hi, When I Synchronize UltraLite with Oracle 8.1.7, I got a error: E. 12/26 00:18:39. [sys]: Error: ODBC: [MERANT][ODBC Oracle 8 driver]Invalid datetime format. Error in parameter 4. (ODBC State = 22007, Native error code = 0) E. 12/26 00:18:39. [sys]: Error: Unable to insert into table "PWQK" using new_row_cursor I. 12/26 00:18:39. [sys]: The error is as follows: sqlcode = 0 odbc_state = 22007 message = ODBC: [MERANT][ODBC Oracle 8 driver]Invalid datetime format. Error in parameter 4. (ODBC State = 22007, Nat...

Problem of setting datetime value in Ultralite
Dear David, I still has the problem of setting datetime value in Ultralite. According to your help, my code is defined below: DECL_DATETIME dt; Boolean bOK; ULBFirst(ULDatabaseDBtohost, FormDB); dt.year = 1992; dt.month = 10; dt.day = 11; dt.hour = 10; dt.minute = 20; dt.second = 3; dt.microsecond = 0 bOK = ULBSetDateTime(ULDatabaseDBtohost, tohost_create_date, dt); if (!bOK) { DisplayNotice("Can't update!", "OK", ""); return false; } ULBUpdate(ULDatabaseDBtohost, 0); I pass the compilation, but fail to run. The ULBSetDa...

PPB and Ultralite<->ASE with publications
Thanks guys - upgrading latest EBF on ASA and PBB got me up and running.... Now for the next question, hope I'm able to explain this properly I've made a sync object for Ultralite with the wizard, and tried to write some code that syncronize a single table in a UltraLite shceme. I've written similar code in Java that successfully does the sync. Now the PB-code is as follows: SQLCA.DBMS = "TRACE UL9" SQLCA.AutoCommit = False SQLCA.DBParm = "ConnectString='DBF=C:\ulite\tnt.udb;UID=dba;PWD=sql'" Connect using SQLCA; nvo_ulite_ulsy...

Ultralite plan ( query performance problem)
I have a query on the Ultralite database which runs pretty slow, (30+ seconds). number of rows in each table: MS_REP: 3000 MS_REP_SALES_SUM: 6000 ( 3000 of which qualify for the join in the query listed below) MS_REP_AUM_SUM: 3000 If i have the MS_REP_SALES_SUM table empty in my UL database, the query runs in less than 10 seconds. The query is a 3 table outer join, MS_REP, MS_REP_SALES_SUM, MS_REP_AUM_SUM. Query: SELECT R.REP_ID, R.FIRST_NM, R.LAST_NM, R.STATE_ID, R.PRIM_PHONE, R.PRIM_PHONE_EXT, R.FIRM_NM, ISNULL(A.AUM_AMT,0), ISNULL(S.REDEMPTIONS,0), ISNULL(S.TRADE...

Issues migrating from .NET Ultralite 9.0 API to Ultralite 11.0 API
The query is regarding migrating from UltraLite 9.0 API to UltraLite 11.0 API We have written a .NET component which performs the synchronization operation; this was initially written using the UltraLite 9.0 and .NET Compact Framework 2.0. We now migrated this component to .NET Compact Framework 3.5 and UltraLite 11.0, while doing this there where some methods and properties which were missing in the new version of UltraLite API 11.0 as seen below; due to which we are unable to compile this component. I tried searching the Sybase knowledgebase for any help regarding this but u...

UltraLite: Problems with SQL key words in query
Hello, I've got a problem with querying my UltraLite database. Unfortunately I've got to use a database schema which I cannot change and which has got some tables with conflicting column names like "GROUP", "COMMENT" and so on. E.g. "ShoppingBasket"."Group" or "UserComments"."Comment". Anytime I want to bind one of these tables my UltraLite database to an .NET form I get an error because of the conflicting column names. If I leave exclude these columns from my query everything works fine. I've tried seve...

Web resources about - DateTime Query in Ultralite - sybase.sqlanywhere.ultralite

NEC UltraLite - Wikipedia, the free encyclopedia
The product was originally developed by an NEC Japan telecommunications engineering team that was trying to make an inexpensive lightweight terminal ...

1992 GM Ultralite running concept car - YouTube
... the North American Auto Show in Detroit in January 1992, the centerpeace of the General Motors exhibit, the running fully functional GM Ultralite ...

The GM Ultralite — 1400 lbs, 100 MPG, and You Can’t Have It
... and far less well known than it should have been, and we all taste bitter regret at what could have been . This is the case with the GM Ultralite, ...

NEC debuts VersaPro UltraLite VB laptop, Mate MG all-in-one for Japan
Like your computers to be all-business and only available in Japan? Then you might want to take a gander at NEC's latest duo, which includes ...

New Freescale I.MX6 SoCs Include IoT-focused UltraLite
... including new DualPlus and QuadPlus parts featuring enhanced GPUs and expanded memory support, and a new low-end, IoT focused 528MHz UltraLite ...

Portlandia Meets Ad Agency Snobbery This one hits... - 2matts.com
Portlandia Meets Ad Agency Snobbery This one hits a little too close to home. [via: IFC]

Travelers Have Always Expected Suitcases to be Light and Strong - Adweek
Travelers have always expected suitcases to be light and strong

NEC – New business-oriented PC lineup – 12 types (28 models)
... 34.9mm slim body 15.6 inch laptop PC “Versa Pro Type VX” with USB 3.0 built-in and a super light (875g, 14.9mm thin) laptop PC “VersaPro UltraLite ...

BASE Jumping Articles
Skip to Content Basejumper.com Home Forums Articles Gear Classifieds Photos Videos Email Help Submit an Article My Bookmarks Tags Search Forums ...

New Technology Running Shoes : Reebok RealFlex Run Men's
New technology running shoes like these Reebok RealFlex Run Men's "Give your feet the flexibility they deserve. RealFlex sensors work together ...

Resources last updated: 12/28/2015 6:46:41 PM