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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VFP Label + MySQL

Status
Not open for further replies.

Yosua

Programmer
Aug 23, 2011
25
Hi,
I'm looking for a tutorial on how to create label with MySQL table, but I found nothing on the Google. So I believed this forum is a good start.
Can anyone tell me how to create label with MySQL table?

Thanks
 
how to create label with MySQL table

Let's start with the basics...

You can use VFP to get a record set (one or more records) from a data table within a MySQL Database by issuing the appropriate SQLEXEC() command after having established a Connection to the MySQL Database.

If you already know how to do that, great.
If not, then begin by studying how that is done.

Then, once you have the record set meeting your desired criteria, into a VFP Cursor, you can use it to send to a VFP Label Form.

Good Luck,
JRB-Bldr
 
Hi JRB-Bldr,
Yes, I know the basic SQLEXEC(), but how to put it into VFP Label writer?
I've made a cursor for the SQLEXEC() but I can't find it in the Expression (Field Properties).
 
hello Yosua

how is your sqlexec statement.
when you have a cursor file for example

sql = "select * from dbo...."
retcode = sqlexec(handle,sql,"t_label")
if retcode > 0
select t_label
go top
count to m.i
if m.i > 0
select t_label
go top
*** then do this
suspend
***** the program wil suspend en you can create a new label from the foxpro menu new file choose label

endif
select t_label
use
else
wait window "not a good connection"
endif


when the label is made you ommit the supend statement

That is the way I always to it.
I hope this can help you

Filip
 
I've made a cursor for the SQLEXEC() but I can't find it in the Expression (Field Properties).[/qupte]

You need to be sure that the cursor exists while you are working in the label designer. And also, it must be in the current work area.

Alternatively, just type the field names by hand in the expression dialogue. Presumably, there are only a few fields in the label, and you know all their names, so it shouldn't be a problem. Provided the cursor exists when you run the labels, it should work fine.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
Thanks fluppe, Mike
So it should be fine when I run it, even when the cursor is not listed in expression.
Thanks for your time :)
 
So it should be fine when I run it, even when the cursor is not listed in expression.

Exactly. The expression builder is only for your convenience, to save you typing the field names. But it's also OK to type the field names if the cursor isn't available at that time.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
Then I'll do it manually. Thanks Mike
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top