| Author |
Accessing a database field - question.
|
|
| William Herrera 2006-02-19, 8:28 pm |
| Hello guys,
I have no words to describe how much of a help this news group thing has
been to me as a dBase programmer. Without it ... I just don't know where
I'll be.
Writting a program, I need to store into a var a field from a database (have
not done this for a while now and forgot)
Use Clients.DBF
Store ???????????name_of_the_field to var
Any help would be great.
| |
|
| > Writting a program, I need to store into a var a field from a database
> (have not done this for a while now and forgot)
> Use Clients.DBF
> Store ???????????name_of_the_field to var
var = name_of_the_field
| |
| William Herrera 2006-02-19, 8:28 pm |
| This is a very simple routine that is not working for me.
Local v_Days
v_Days = 20
Use L.DBF # Name of the Database
IF L = .F. # L is the name of a logical field
Append Blank # If L is set to .f. then append a blank record
Replace D with v_Days # D is the name of a numeric field
Close Tables # Just about here I should have a record created but when
I look... nothing, DBF is just the way it was.
ENDIF
Return
"Ken B" <bogus@nowhere.com> wrote in message
news:8XteJybNGHA.1740@news-server...
> var = name_of_the_field
>
>
| |
| Ken B 2006-02-20, 11:23 am |
| > This is a very simple routine that is not working for me.
> Local v_Days
> v_Days = 20
>
> Use L.DBF # Name of the Database
>
> IF L = .F. # L is the name of a logical field
> Append Blank # If L is set to .f. then append a blank record
> Replace D with v_Days # D is the name of a numeric field
> Close Tables # Just about here I should have a record created but
> when I look... nothing, DBF is just the way it was.
>
> ENDIF
> Return
-----------
** don't try to compare a logical field equal to a logical value. I'm not
sure why there is a problem with that method. I think it is how dBASE
stores logicals internally that causes a problem. You just need to access
the field itself.
One other problem you might have is the name of the table and the field name
are the same ( "L"). You should use the syntax of tableName->fieldName.
Like L->L. This will eliminate a lot of confusion.
IF .not. L->L # L is the name of a logical field
Append Blank # If L is set to .f. then append a blank record
Replace D with v_Days # D is the name of a numeric field
Close Tables # Just about here I should have a record created but when
I look... nothing, DBF is just the way it was.
ENDIF
Return
PS:
Please state what version of dbase you are using when posting so people can
give the appropriate solution.
Thanks,
Ken
|
|
|
|