Excel to cursor?  
Author Message
lil_isie





PostPosted: Visual FoxPro General, Excel to cursor? Top

Hi guys, I am working with some data that is about 400 lines long, and I need to update it into MS SQL 2000 via Visual FoxPro. I need to know, is there a way I can take excel data and import it into a FoxPro cursor

Thanks



Visual FoxPro2  
 
 
Dave M.





PostPosted: Visual FoxPro General, Excel to cursor? Top

http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=509710&SiteID=1

Dave M.



 
 
lil_isie





PostPosted: Visual FoxPro General, Excel to cursor? Top

I hate to say that it isn't helpful, but it isn't. Essentially each piece of info that is on the .xls file exists on the database; however, those values in the .xls file, if they exist in the SQL server database, another value that is tied with it needs to be changed. For example if "7h4f033446" exists active needs to be changed to 'A'.

I don't need to clearly import it, what I need to do is take the information and use it to modify tied information.

And with that I need to move specifically the data that is in the .xls file TO a cursor. Is there a way to do that


 
 
Alex Feldstein





PostPosted: Visual FoxPro General, Excel to cursor? Top

You ned to import Excel data into a VFP cursor (Dave showed you one way of doing that).

Once you have the data in a temporary cursor (or save it in a permanent DBF if you want). you traverse te cursor with SCAN..ENDSCAN and for each record you look to see if it is in SQL Server. Once found just update the SQL Server record witn the info you want.

To connect to SQL Server from VFP you have several ways:

  • ODBC
  • OleDB+ADO
  • Cursor Adapter (ODBC or OleDB)
  • Remote Views (ODBC)

Read the chapter on Client/Server in the help files.

Read about Cursor Adapter, SQL Pass Through and Remote Views
Main SPT functions to look in help:
SQLConnect()
SQLStringConnect()
SQLExec()
SQLDisconnect()

http://fox.wikis.com/wc.dll Wiki~CategoryClient/Server

http://fox.wikis.com/wc.dll Wiki~VFPCommandSQLStringConnect


 
 
Dave M.





PostPosted: Visual FoxPro General, Excel to cursor? Top

I don’t understand...

What’s giving you trouble

Dave M.



 
 
lil_isie





PostPosted: Visual FoxPro General, Excel to cursor? Top

I don’t understand...

What’s giving you trouble

Dave M.



I'm sorry Dave, I completely misunderstood what you had written there in the other thread. What you wrote was helpful, and the answer, as was what Alex posted.

Again, sorry for the confusion.


 
 
lil_isie





PostPosted: Visual FoxPro General, Excel to cursor? Top

Alright guys, it's looking like there are new problems afoot!

What you guys suggested with the sqlstringconnect() works, with on exception: it is not stable. It will work sometimes, and othertimes it will not. On my workstation it always works; however, unless I go, open up Microsoft Excel on a co-worker's machine, and then use the sqlstringconnect(), it will not work. I get error 1446: Connection handle is invalid.

Any ideas guys