Missing FieldNames by using Records.FieldNames

Questions regarding syntax

Missing FieldNames by using Records.FieldNames

Postby PMan » Thu Jan 06, 2011 3:10 pm

Hi,

I tried to read out fieldnames from a tables with recordset. I used following statements

sSQL = "SELECT * FROM " & sTblName & ";"
sRecID = Records.Open(sDBName, sSQL)
sDBfldNames = Records.FieldNames(sRecID)

But i missed 2 or more or all fieldnames using the statements with differnt tables.Why?

A solution of this problem is to use installation_schema from SQL-Databases like I show in SQL Functions FieldType, FileldDimension. I find out, that dictionary sort there value alphanumeric, so I must design a routine to sort the sequence numeric to get the right order.
PMan
 
Posts: 145
Joined: Sat Jul 03, 2010 12:31 pm
Location: Switzerland

Re: Missing FieldNames by using Records.FieldNames

Postby Henning » Thu Jan 06, 2011 8:49 pm

Is it anyway related to this error?
It seems that Records. isn't only forwarding fieldnames, but for some unknown reason is interpreting them someway.

The error is thrown from a FieldName "size". It is working from the VB original code, and has been working in KB some versions back.

Code: Select all
          fld = "size"
          ArtRec(rc).arSize = Records.Value(sRecordsId, fld)

---------------------------
Error in Warning: QSqlDatabasePrivate::removeDatabase: connection 'skidata' is still in use, all queries will cease to work.
---------------------------
Warning: QSqlDatabasePrivate::addDatabase: duplicate connection name 'kbasic_internal', old connection removed. runtime error: Cast exception in line 0
---------------------------
OK
---------------------------


/Henning
Henning
 
Posts: 262
Joined: Mon Feb 09, 2009 12:03 am
Location: Sweden

Re: Missing FieldNames by using Records.FieldNames

Postby PMan » Tue Jan 25, 2011 5:14 pm

Hi,

i have writen that i missed some fieldname in a recordset i a routine. Becaus of this problem, I rebuild this routine with queries. Now I write a second routine using recordsets and the same procedure like in the first routine. Thie routine runs very well with no errors. I don't know why the first routine bring out too less fieldnames.

/PMan
PMan
 
Posts: 145
Joined: Sat Jul 03, 2010 12:31 pm
Location: Switzerland


Return to Coding Questions

cron