April 24, 2024, 03:28:48 PM

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


text greater then 255 characters

Started by Pip1957, June 08, 2008, 11:46:44 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Pip1957

I have created a mdb dbase with 17 columns the last 11 columns need to hold text of greater than 255 chars, I have set the datatype as memo but when I insert to the dbase I get the error (COUNT FIELD INCORRECT)
this only happens when the Istring var is greater than 256 and the dbbindparameter is greater than 255, any ideas. :-\

LarryMc

Without seeing your code all I can offer is snippets from a program I wrote:

The table (longtext is a memo field):
ctStmt = "CREATE TABLE funccat("
ctStmt = ctStmt+"funccat_recno counter(1,1),"
ctStmt = ctStmt+"funccat_declare_type varchar(40),"
ctStmt = ctStmt+"funccat_ret_type varchar(40),"
ctStmt = ctStmt+"funccat_name varchar(100),"
ctStmt = ctStmt+"funccat_desc longtext,"
ctStmt = ctStmt+"funccat_ex longtext,"
ctStmt = ctStmt+"funccat_remarks longtext,"
ctStmt = ctStmt+"funccat_overload_flag varchar(2),"
ctStmt = ctStmt+"inccat_recno int,"
ctStmt = ctStmt+"funccat_ret_desc longtext,"
ctStmt = ctStmt+"funccat_update date"
ctStmt = ctStmt+")"
hstmt = dbExecSQL(pdb,ctStmt)


field size constants:
const desc_len=3000
const sdesc_len=500
const ex_len=3000
const rem_len=2000
const ret_desc_len=2000


definition of bound variables:
global funccatrecno :int funccatrecno :funccatrecno =0
global funccatdeclaretype :istring funccatdeclaretype[40] :funccatdeclaretype=""
global funccatrettype :istring funccatrettype[40] :funccatrettype =""
global funccatname :istring funccatname[100] :funccatname =""

global funccatdesc :istring funccatdesc[desc_len] :funccatdesc =""
global funccatex :istring funccatex[ex_len] :funccatex =""
global funccatremarks :istring funccatremarks[rem_len] :funccatremarks =""
global funccatovrloadflg :istring funccatovrloadflg[2] :funccatovrloadflg =""
global funccatretdesc :istring funccatretdesc[ret_desc_len] :funccatretdesc =""


code to UPDATE just the memo fields:
hstmt_update = dbPrepareSQL(pdb,"UPDATE funccat SET funccat_desc=?,funccat_ex=?,funccat_remarks=?,funccat_ret_desc=? WHERE funccat_recno = "+str$(funccatrecno))
dbBindParameter(hstmt_update,1,funccatdesc,255)
dbBindParameter(hstmt_update,2,funccatex,255)
dbBindParameter(hstmt_update,3,funccatremarks,255)
dbBindParameter(hstmt_update,4,funccatretdesc,255)
dbExecute(hstmt_update)


part of the code where a record is loaded for editing:
IF hstmt_select
dbBindVariable(hstmt_select,1,funccatrecno)
dbBindVariable(hstmt_select,2,funccatdeclaretype,null,40)
dbBindVariable(hstmt_select,3,funccatrettype,null,40)
dbBindVariable(hstmt_select,4,funccatname,null,100)
dbBindVariable(hstmt_select,5,funccatdesc,NULL,desc_len)
dbBindVariable(hstmt_select,6,funccatex,NULL,ex_len)
dbBindVariable(hstmt_select,7,funccatremarks,NULL,rem_len)
dbBindVariable(hstmt_select,9,xd9_inccatrecno)
dbBindVariable(hstmt_select,10,funccatretdesc,NULL,ret_desc_len)
endif
dbGetFirst(hstmt_select)


Hope this helps

Larry
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library