Re: Embedded SQL and Converting SQLDTIME to ASCII
Posted in 1998
tracy.kuhrt@altavista.net wrote: > I am trying to convert a SQLDTIME to an ascii string using Embedded SQL in C. > > I am initializing the sqldata pointers in the following manner: > > fldCount = qSQLDA->sqld; > [SNIP] > > > > > I have looked at many examples and tried many different ways to get this to > work. I am getting fairly frustrated. I have all other field types converted > to ASCII, it is just this one that is giving me problems. Any help would be > greatly appreciated. > > TIA, > Tracy > > -----== Posted via Deja News, The Leader in Internet Discussion ==----- > http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum > > Use the 'rtypwidth()' function to get the size of the ASCII converted data, like so: qSQLDA->sqlvar[i].sqllen = rtypwidth(colPtr->sqltype, colPtr->sqllen) + 1; The extra 1 is for the terminating null character. Then change the data type to character, like so: qSQLDA->sqlvar[i].sqltype = CCHARTYPE; After the fetch, your 'sqldata' will contain the ASCII converted string and you can print it out like so: printf("%s", qSQLDA->sqlvar[i].sqldata); HTH, Avi. ************************************************************************ /\\ \\ /| Avi Abrami, Analyst/Programmer, Telegate Ltd. /__\\ \\ / | 7 Haplada Street, Or-Yehuda, ISRAEL / \\ \\/ | Phone:+972-3-5388717 Fax:+972-3-5335877 eMail:avia@telegate.co.il