 |
 |
Index ‹ Visual FoxPro ‹ Visual FoxPro General
|
- Previous
- 1
- Visual FoxPro General Set printer to NAMEHi;
I am using "Set printer to NAME getprinter()" to select a printer.
I also have tried "Set printer to name \\somePC\someprinter"
In both cases an error is produced. "Error accessing print spooler"
The network is a win2003 server with both XP pro and Win98 stations.
The printer is on a win98 station.
I was wondering if I should use "set printer to \\somePc\somePrinter" without the NAME clause
Thanks.
- 2
- Visual FoxPro General VFP TIMER MEMORY PROBLEM
Hi All,
Our product is a 24/7 Hospital product and i face a critical issue in Timer control.
The below code is a small example of my process, i created an exe of this code and this runs as a process in the task manager. The issue is this eats up memory consistently in time intervals.
if this exe is ran for days the memory is used is like in MBs and slowing down the PC's performance.
TimerCtrl()
procedure TimerCtrl
LOCAL poTim
poTim = createobject( "iTimer")
poTim. interval = 1000
poTim. enabled = .t.
read events
endproc
*=========================================================================================================================
define class iTimer as timer
function timer
RETURN
ENDFUNC
enddefine
I tried using the memory allocation command in the Timer Event to limit to 6800 KB but it didnt work.
= sys(3050, 2, 6800 * 1024)
My scenario is like this we have some files in a folder from another application which i have to access constantly in a time interval of one second and read the files separate the tokens and put in my Applications DBF.
do we have any other way we can do this in VFP.
i tried with DO While .t. Loop but its eating up the processor time upto 50% which is too costly for our customer.
Please suggest me some solution where i can limit the memory usage.
Kindly Advice me.
Thanks in advance
-Venkatram
- 3
- Visual FoxPro General Wait Window "" timeout 0.01 and Sleep(10) in VFP-9 At times my VFP processing requires *rest(s)* it seems. (report processing/printing, various functions, .BeforeRowColChange events, etc.)
I've *discovered*:
Wait Window "" timeout 0.01 && ... helps at times
while the preferred:
Windows API Sleep() routines && ...I've had NO success with API Sleep() declarations
Any general or specific feedback concerning *rest(s)* in VFP-9 is appreciated.
- 4
- Visual FoxPro General FoxPrint font.In order for users to be able to use a font, is it enough for it to
reside in the working folder of my VFP app, or do I need to install the
actual font
Thanks again,
Aleniko
- 5
- 6
- 7
- Visual FoxPro General Selecting multiple headers in grid.Hi everyone;
I'd like to make a change to multiple headers in a grid at design time.
For example, I'd like to change the alignment of the headers. Please
keep in mind that I rather not do a setall but do this at design time.
There must be an easy way to do this...
Thanks,
Aleniko
- 8
- Visual FoxPro General Microsoft Access to Visual FoxPro? Hey again guys, it's been a while.
I am here for a co-worker of mine. We have to do a database to database transfer from Access to FoxPro.
The thing is, our DBA wants us to write a program for this; however, we just cannot find anything for answers.
My question for you is: would this be possible to do a database transfer If so, what am I missing here Something must be right under my nose and I am not seeing it.
Thanks in advance!
- 9
- Visual FoxPro General Philadelphia VFP User Group--Wednesday, August 9The Philadelphia Visual FoxPro User Group will meet on Wednesday,
August 9, 2006 at 7PM at Valley Forge Pension Management, 715 Twining
Road, Suite 202, Dresher, PA 19025. Anyone interested can meet for
dinner at 6 PM at Rocky's in the shopping center across the street.
Speaker: Kevin S. Goff
Kevin S. Goff is the founder and Principal Consultant: Common Ground
Solutions. He has 18 years experience - NET/SQL Server/Crystal
Reports/Visual FoxPro and is a 2005-2006 Microsoft .NET MVP for C#.
Kevin is the author of “The Baker’s Dozen” series in CoDe Magazine
(Productivity Tips for .NET, Crystal Reports, and T-SQL) and one of the
2005 Personalities of the Year on the Universal Thread for .NET and SQL
Server.
Kevin's current activities include multiple .NET project contracts,
writing regularly for CoDe magazine, a book contract with Apress on
Reporting Solutions in VS2005, a contract to write exam questions for
VS2005 certification exams, speaking at 2005/2006 Dev TeachOffsite link
to http://devteach.com,
MSDN CodeCamp, and .NET User Groups, the Common Ground Framework for
.NET (free framework). He has awards and citations from the Dept. of
Agriculture and large corporations.
Reach him at www.commongroundsolutions.net, kgoff@commongroundsolutions.net. Read his blog at http://www.TheBakersDozen.net.
Topic: Introduction to .NET (from a VFP perspective)
This discussion will include: an overview of the VS2005 environment,
and general project structure; C# or VB ; Windows Forms; Creating
classes/subclassing Winform controls; Data binding and data binding
interfaces; Building a data access layer; Typed datasets; Distributed
architectures with web services and remoting; String and date
operations; Reflection and type discovery and uses of interfaces;
Delegates and events; Miscellaneous tips
- 10
- Visual FoxPro General Edit field in Browse do not respond
*===================================== In the following module Item code entered in the "Datafile" is checked with codes in stock master in the order of codes. The code exists in the Stock master, and the Return 1 is effective. But the cursor is not moving to enter the next Name field. *========================== SELE 1 USE STKMAST ORDE CODE SELE 2 DATAFILE *---------------- 50 Blanks added to Datafile CTR = 1 DO WHILE CTR <= 50 APPE BLAN CTR = CTR+1 ENDDO *----------- Data Entry GO TOP BROW FIEL SRNO:H="Ser#", CODE:H="tem Code"; :V=CHKITEM(CODE)>0,:E="Code Error":F,NAME:H="Customer Name" CLOS ALL RETU *----------------------- Code Check PROC CHKITEM *------- PARA CD SELE 1 SEEK CD IF FOUND() SELE 2 RETU 1 ENDIF *------- SELE 2 RETU 0 *==================
- 11
- 12
- Visual FoxPro General Grid columns populated with incorrect dataI have a grid with a bunch of columns. First, I suspect that the
control source for the columns in this grid 'resets' itself to 'none',
but I am not sure about this.
Second, When I manually fill in the control source for the columns,
some of the columns get populated by the next field in the cursor
regardless of what I have specified in the control source.
Help...
Aleniko
- 13
- Visual FoxPro General Guidance Required for VFP - MSSQL upgradation...
Hi all,
I've developed a VFP application in vers. 6.0. Now that the client wants the same with MS SQL / Oracle. Please someone tell me the list of atricles and other notes i've to go through..... I'm ok with SQL querries....
Please suggest me regarding the -Remote views, SPT's......
The application as a whole has about 2 GB of data in VFP.....
It's a multi-user application....running on VFP 6.0 ./ WIn2000 Platform.
Thanks in advance...
-Markish
- 14
- Visual FoxPro General Views
I am trying to write a VFP Remote View that selects data from a Microsoft Database, unfortunately some of the mssql fields are reserved word (IN FOXPRO) so the VFP will not allow me to inlude these fields in the view.
For example this remote query pulling data from MSSQL by a foxpro view
select table1.pers_name, table1.pers_address, table1.values from table1
returns an error because of the word Values is a reserved word in foxpro.
Is there a way to get around this.
- 15
- Visual FoxPro General "When" firing after "Valid"Hi all;
I am temporarily using an older SPR in VFP 9 as it is. I have had some
problems with the code, and after using the debugger I have learned
that in a "Get, when, valid" command, the "When" fires AFTER the
"Valid".
Anyone had experienced a simillar probem Any ideas why
Thanks,
Aleniko
|
| Author |
Message |
Markish

|
Posted: Visual FoxPro General, Guidance Required... |
Top |
Hi all,
I've developed a VFP application in vers. 6.0. Now that the client wants the same with MS SQL / Oracle. Please someone tell me the list of atricles and other notes i've to go through..... I'm ok with SQL querries....
Please suggest me regarding the -Remote views, SPT's......
The application as a whole has about 2 GB of data in VFP.....
It's a multi-user application....running on VFP 6.0 ./ WIn2000 Platform.
Thanks in advance...
-Markish
Visual FoxPro2
|
| |
|
| |
 |
CetinBasoz

|
Posted: Visual FoxPro General, Guidance Required... |
Top |
If it's possible upgrade to VFP9. VFP9 has cursoradapter class which makes it much easier to deal with multiple data sources, use stored procedures as sources etc.
In VFP6 and later you can use Remote View and SPT. Remote Views are easier for the developer because VFP handles most the tasks for you, however you have less control upon it. SPT's are a little harder but lets you take the control and said to be faster.
From VFP side it's not complex. However you need to be familiar with SQL server and Oracle IMHO. VFP's own F1 help give a lot of information about it. Here are quick starters:
-Connect with a connection string
lnHandle = SQLStringConnect( "Driver=SQL server;Server=(local);Trusted_connection=yes;Database=pubs")
-Use parametric queires rather than hardcoding
* Do not prefer this
lcLastName = 'Karson' SQLExec( m.lnHandle, "select * from authors where LName = '"+m.lcLastName+"'", "myCursor")
* But this
lcLastName = 'Karson' SQLExec( m.lnHandle, "select * from authors where LName = m.lcLastName", "myCursor")
Parametric approach especially solves problems with passing correct parameters with other types such as date/datetimes.
-Try to use [ ] around your table and field names (designer doesn't do this for you unfortunately). It makes backend understand that you're not referring to a keyword but a field/table when you used a table/fieldname that's same as a keyword. ie:
select [desc] from [values]
However generally it's a bad idea to use keywords as field/tablenames and thus you might not need this at all (check a recent post related to this).
I think following code shows how to use SQL server via SPT in a nutshell for a starter:
Clear All csql = "SELECT EmployeeID, LastName, FirstName," + ; "Title, TitleOfCourtesy, BirthDate," + ; "Hiredate, Address, City, Region," + ; "PostalCode, Country, HomePhone," + ; "Extension, Photo, Notes," + ; "ReportsTo, PhotoPath FROM dbo.Employees"
lnHandle=Sqlstringconnect('DRIVER=SQL Server;'+; 'SERVER=(local);DATABASE=Northwind;Trusted_Connection=Yes')
SQLExec(lnHandle,csql,'v_emp') && v_emp has data now but not updatable * You can browse and change data but it wouldn't update * at backend unless you prepare it to be updatable
* Make v_emp updatable CursorSetProp('KeyFieldList','Employeeid','v_emp') CursorSetProp('WhereType',1,'v_emp') CursorSetProp('Tables','employees','v_emp')
* Specify fields' mapping * Mapping is in pairs * On left there is local field name and on right * tablename.Fieldname on backend. * employeeID employees.employeeid * employeeID is local field name mapping to * employees.employeeid on backend * In other words if set to be updatable * v_emp.employeeID would update employees.employeeID at backend * Note: Include key field in this list even though you might not * want it to be updatable TEXT to m.lcUpdateNameList noshow employeeID employees.employeeid, Lastname employees.Lastname, Firstname employees.FirstName, Title employees.Title, TitleOfCourtesy employees.TitleOfCourtesy, BirthDate employees.BirthDate, Hiredate employees.Hiredate, Address employees.Address, City employees.City, Region employees.Region, PostalCode employees.PostalCode, Extension employees.Extension, Notes employees.Notes, ReportsTo employees.ReportsTo, PhotoPath employees.PhotoPath ENDTEXT CursorSetProp("UpdateNameList", ; Chrtran(m.lcUpdateNameList,Chr(13)+Chr(10),''),'V_emp')
* Specify fields that could be updated CursorSetProp('UpdatableFieldList',; "LastName, FirstName," + ; "Title, TitleOfCourtesy, BirthDate," + ; "Hiredate, Address, City, Region," + ; "PostalCode, Country, HomePhone," + ; "Extension, Notes," + ; "ReportsTo, PhotoPath",'v_emp') CursorSetProp('SendUpdates',.T.,'v_emp') * We want all updates to occur in a batch * so setting to table level buffering CursorSetProp('Buffering',5,'v_emp')
Browse Title 'Editable fields are all except Id and Photo' * Update backend with changes If !Tableupdate(2,.T.,'v_emp') Aerror(arrWhy) Display Memo Like arrWhy EndIf * Requery data from backend to see if it has been really updated SQLExec(lnHandle,'select * from dbo.employees','afterupdate') SQLDisconnect(lnHandle) Select afterupdate Browse
For a starter to SQL server, easiest is Remote Views IMHO. Create a connection in a database (you can use connectionstring as in SPT sample). Using that connection create remote views in designer (do not forget to mark 'Send Updates' if you'd want updates to persist). Those views are just like any other local table/view from your POV (with default buffering of 3 - you can change buffering to say 5 and views are always buffered).
These should be enough to wet your appetite. You asked for articles and such but I don't know what to suggest and where:) I'd just start in a test folder and ask specific questions when something doesn't seem to work the way it should. Aerror() would be your best friend in that case. IMHO it's an illusion that you could write the same codebase for both backends. Both have extensions of their own to ANSI SQL and you'd want to leverage them. However you could keep these in classes and call one or the other depending on the provider.
Good luck and don't be afraid, at first it sounds to be complex and you have many hurdles but it is really a fun once you start. Do not forget to download SSE (SQL server 2005 express) with its management studio (alternatively you might get SQL server developer edition for 49$). They have tools that would let you write and test needed SQL query blocks.
|
| |
|
| |
 |
Markish

|
Posted: Visual FoxPro General, Guidance Required... |
Top |
Thanks Cetin,
I started with the RV's....In the multiuser env. I land up in some troubles....resulting to update conflict....Like
- One user editing a record
- another user deleting the same record at the same time....
How to go about this.....like using rlock() in fox....Can u guide me in this...
-Markish
|
| |
|
| |
 |
CetinBasoz

|
Posted: Visual FoxPro General, Guidance Required... |
Top |
Markish,
Even within VFP rlock() approach is not very good IMHO. Your application's needs would really shape it. Once I posted a sample code on universalthread demonstrating "rlock" for VFP/MSSQL table in asp.net. You might search it there. The idea was using an intemediate helper table that keeps 'locks' with uniqueids per user and table/record that are 'locked'. Nothing was really locked and a user could keep a lock for a predefined maximum period (unless reacquire the lock before max timeout reached - defense against disconnections, get the lock and go to home etc style scenarios). However it was for demonstration purposes only. In general optimistic buffering and first write wins approach works for most applications. For example in your case, what if it was edited and committed first then immeditealy deleted by another user. Would it matter it was deleted while being edited or just later (It might depending on application). You can catch it in tableupdate() and check aerror(). VFP help has a section detailing such and similar conflict scenarios and I think there is an ConflictChecker class in solution.app. VFP has support for offline views, read it too. In an offline scenario it'd be more obvious, one user might edit the data while it's offline and another user might delete the data online. Offline user wouldn't know if it's deleted or not till she/he reconnects and has no way to "lock" the record for editing (ie: think you took the data offline on to your notebook and went to a village where no internet or alike connection is available). OTOH this might be a bank like "transaction" and you might really need it. SQL server (I don't know Oracle at all) has a series of isolation levels and transaction support. If you don't need such a thing, they're complex for a starter IMHO. First think about your application design. If you really need it intemediate 'lock' tables might be the solution (batches of SQL is automatically transactional and you could still wrap in explicit transactions - transactions are overused when someone doesn't really need it and I just don't want to direct you in a wrong way from the start. If you want it at least for testing execute a "begin transaction" command on your connection, however initially do it just for testing, and use only when you are comfortable with them, otherwise you'd also need to understand 'deadlock' situations and management well).
PS: Off the record, despite some myths you might be pleased later, if you use GUID primary keys for your tables. They have pros and cons where pros outweigh IMHO.
|
| |
|
| |
 |
Markish

|
Posted: Visual FoxPro General, Guidance Required... |
Top |
Thanks a lot... I'll take it forward... and let you know when I'm struck
|
| |
|
| |
 |
Craig Berntson

|
Posted: Visual FoxPro General, Guidance Required... |
Top |
|
| |
 |
| |
 |
Index ‹ Visual FoxPro ‹ Visual FoxPro General |
- Next
- 1
- 2
- Visual FoxPro General VFP menu bar problem
i have problem with VFP menu
when i call my menu to work in VFP IDE and i write
set sysmenu to rtljustify
i have the required result
but when i call the menu to work in top level form
do mymenu.mpr with thisform, .t.
and i write , set sysmenu to rtljustify
i don't have the required result
any soultion for this problem
Greetings,
- 3
- Visual FoxPro General fix corrupted dbf hello,
i'm opening a table in the command window and it display a message that the table is corrupted and needs to be repaired before it can be use again. Can anyone help me fix the dbf Is there a free software to fix the corrupted dbf
any help will be greatly appreciated
thank you
jason
- 4
- Visual FoxPro General Database name in subreport with Visual Foxpro 9 with Crystal reports 9
Hi, I am using Visual Foxpro 9 with Crystal reports 9 any one could help me to change the data source of my subreport.
I am using a native Xls data type in my crystal report. I have subreport having another datasource with native Xls data type also and attched to the main report.
I could change the data source of the my main report but the problem is how to change the data source for the subreport.
I am using this code to create the report from Vfoxpro: *-------------------- Public CRApplication Public CRReport Public CRParm CRApplication = createobject ("CrystalRuntime.Application") CRReport = createobject ("CrystalRuntime.Report") CRReport2 = createobject ("CrystalRuntime.Report") REPNAME=REPSPATH+'SURVEY.rpt' && report file name for the main report REPNAME2=REPSPATH+'ssurvey.rpt' && report file name for the subreport
CRReport = CRApplication.OpenReport(REPNAME) &&*!* Open up the report **-- determin the DATA SOURCE FILE myLocalDataFile=(DataPATH+'XLFile.xls')
*-- to change the database source for the main report CRReport.Database.Tables(1).ConnectionProperties.Item("Database Name") = myLocalDataFile *--- *-- I need the exact code here to change the data source of the subreport *--- DO FORM PrevForm
WITH PrevForm.OleControl1 .reportsource = CRReport && *!* Attach the report to the viewer .ViewReport && Start the Crystal Viewer ENDWITH
*-------------------- any one could help me !!. Thank you.
- 5
- Visual FoxPro General switching pages in pageframe
I want to be able to detect when I am clicking on a page tab to switch pages, so I can control which portions of a lostfocus event on an object in the current active page will execute.
I appears that I can't use mouseenter on the target page, like I do on command objects.
- 6
- Visual FoxPro General Same Report...Different Printers? Hi all,
What may be causing the same report file to print differently on different printers We are developing the reports in VFP9 and we make sure that tag and tag2 fields are emptied before compiling the exe. The differences are various like: 1. Difference in left/top margin. 2. Extra blank spaces left out in the middle of the report on certain printers. 3. Shift in borders printed along the edge of the report.
The printers in question are HP LaserJet 4000, Brother MFC 3900, ADOBE PDF, Microsoft Fax/Document Image Writer. The latter 2 always leave a very small left margin. All thoughts are appreciated. Bini
- 7
- Visual FoxPro General Command contains unrecognized phrase/keyword VB.Net
Hi
I am facing the above problem when I am trying to insert a MEMO data in to the VFP table. I am using a OLEDB connection string in VB.Net
My data present in the file is
//------------------------------
Pen
Pencil
Erasier
Sharpener
//----------------------------
Each an every line has a (Vbcrlf) that is a line feed in it I need the File as in the above format to be stored in the memo file without any change
I get the data from the file by the following procedure
----------
Dim lstrData As New String(" ", 500)
FileOpen(1, "C:\soc.txt", OpenMode.Binary)
FileGet(1, lstrData)
FileClose(1)
--------
I get the data in the lstrdata Now I use sql statment to insert into the vfp table
sql = "Insert into edifile (theirref,qtnord ) Values (' " & lstrdata & "', 'RRTo')
Public gconnMDB_I As OleDb.OleDbConnection
gconnMDB_I = New OleDb.OleDbConnection
gconnMDB_I.ConnectionString = lstrConnString
Call gconnMDB_I.Open()
Dim cmd As New OleDb.OleDbCommand
cmd = New OleDb.OleDbCommand(sql, gconnMDB_I)
cmd.ExecuteNonQuery()
Once cmd.ExecuteNonQuery is excuted the following error occurs
Command contains unrecognized phrase/keyword VB.Net
- 8
- 9
- Visual FoxPro General Shellexecute on win98 / XP / 2003 server.does Shellexec behave differently on win98 than on XP
I have a shellexecute command to unzip a zip file. The 'pfiles' folder
the zip file resides in is under the folder the application runs in:
=ShellExecute(0,"OPEN","unzip.exe","pfiles\01.zip","",1)
On XP machines it works fine.
On win98 machines it fails because it won't find the pfiles folder.
Thanks.
- 10
- Visual FoxPro General Problem after upgrading to VFP9 from VFP7
The following procedure works fine VFP7. When a second user tries to lock the IDFILE before the first one unlocks it he receives the message and the PROCEDURE returns.
After upgrading to VFP9 the second user instead of the previous message he gets a message from VFP "An error has occurred: File is in use by another user. etc". He gets a similar message if he even tries to open for read the IDFILE while in VFP7 there was no such problem.
PROCEDURE PR_EYRET open database data1 SET DATABASE TO data1 USE IDFILE IN 0 SELECT IDFILE IF !FLOCK() MESSAGEBOX("The file is not available. Try later",16) RETURN ENDIF . . * Do something. . UNLOCK RETURN
Can somebody help me
- 11
- Visual FoxPro General Uppercase in Edit Box Somebody how can I force to Uppercase in a Edit Box . This control doesnt have a Input Mask property, and dont know if the Format property can make it.
Thank you in advance.
- 12
- Visual FoxPro General System time - synchronizing, displaying
Hi experts.
Does anybody know how to get the real time from internet. I want to have the real updated time in my application. Second task is to changing the system time. How can I do that Third task is how to display time in form for example in textbox. I know the way with timer but if there is any other way I will be glad to know it. But the consequence is in the order I have written. Mainly the getting real time from internet.
Thanks
- 13
- Visual FoxPro General Show text file in a form.Hi;
I need to show the user a text file on a form. Is there a better way of
doing this than using low level file commands to fetch the textfile and
then use an editBox
The size of the text file can't be very large - 10-20K or so.
Thanks.
- 14
- Visual FoxPro General VFP Preprocessor Problem
i have probelem with VFP9 preprocessor !
i would like to define new statements syntx to the language.
i want a replacement for #command statement (like in Clipper lanaguge) ,
any helpful idea
Greetings,
- 15
- Visual FoxPro General Speeding up SQL Statements As per Tamar Granor's interest, I'm curious if I can speed this up a bit; it takes almost 3 seconds of user-time on an IBM X41 tablet (SANS networking). Behold:
Select Allt(patient.first_name)+' '+ patient.last_name As PatientName,Record From patient;
UNION (Select Allt(patient.last_name)+', '+ patient.first_name As PatientName,Record From patient);
UNION (Select Distinct Alltrim(Proper(patient.Record))+'
'+Alltrim(patient.last_name)+', '+Left(patient.first_name,1) As
PatientName,Record From patient Where patient.Record <> (' '));
UNION (Select Distinct Alltrim(Proper(visit.insur_no))+'
'+Alltrim(visit.last_name)+', '+Left(visit.first_name,1) As
PatientName,Record From visit Where visit.insur_no <> (' '));
UNION (Select Distinct Alltrim(Proper(visit.sec_ins_no))+'
'+Alltrim(visit.last_name)+', '+Left(visit.first_name,1) As
PatientName,Record From visit Where visit.insur_no <> (' '));
ORDER By PatientName Into Cursor cPatient
Index On PatientName Tag 'PtName' &&test only
The visit table is 30,000 records and contains a bloated visit.fpt file (about 125Mb). The patient table contains only about 5000 records with about 1/10th the .fpt bloat. Both tables are routinely packed and/or reindexed and remain uncorrupted.
Note: These tables have about 50 indexed fields and 15 indexed fields respectively.
Delete() is indexed (with reserve) as is Recno().
Any thoughts are much appreciated in advance.
|
|
|