Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to get each column value in one record

Status
Not open for further replies.

SonicChen

Programmer
Feb 14, 2004
62
CN
i know one function curval()
but i received an error message indicate that curval() must run in row or table buffering mode

way to gold shines more than gold
 
HI

CURVAL() is used to compare the values as it is in a bound control as against the value in the record.

That is, the CURVAL() returns the original value from the table or remote data source.

In a buffered table, the buffer is used to provide the
value and so it need not be the value which might have been the current value as changed by another user in the network.

So it is likely that you are using it on a table or view which is not in use or available for fetching data. Also the buffer is not available to get the earlier data. Hence the error, it seems.

:)

____________________________________________
ramani - (Subramanian.G) :)
 
thanks u a lot, i have try your method.
but curval() return one untype value, i dont' know how to convert untype to string.

way to gold shines more than gold
 
Oh, sorry, i'm too detailed in my problem.
I'm transporting data from VFP to Oracle. Every record with on id in foxpro table need to be translate into oracle's data type, such as memo type. And i need to discard some empty record have only one ID but no content actually.
So i think i should transport every record myself and read the info of each column of the record. as far now, i use the following method
Code:
scan
  take each column value by curval().
  ...
endscan
but curval() return an undefined type. i need the characters type when i use
Code:
cCmd = "INSERT INTO table ("+ cFieldStr +") VALUES ("+ cValueStr + ")"
SQLEXEC(nConn, cCmd)
any help is appreciated here.

way to gold shines more than gold
 
SoniChen,

OK, that makes sense. I think I can help.

You definitely don't want to use CurVal() here, and you don't need to worry about buffering. Neither of those are relevant here.

Given a record with a (character) field named Cust_Name, here is how you insert the record into Oracle:

cCmd = "INSERT INTO table (Cust_Name) VALUES ("+ Cust_Name + ")"
SQLEXEC(nConn, cCmd)

If Cust_Name is some other data type, you would have to convert it to a character string before plugging it into the above statement.

I think you were thinking that you need to use CurVal() to get the "current value" of a column (which seems reasonable). In fact, to get the current value of a column, you just reference the field name directly.

Hope this makes sense.

Mike


Mike Lewis
Edinburgh, Scotland

My Visual Foxpro web site: My Crystal Reports web site:
 
yes , i have done the job.
really good sense.
thanks a lot

way to gold shines more than gold
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top