0

I started to work in project which is designed using visual foxpro,sql sever & this software is customized means we are bayed from other customer & after that in .prg i'm modifying product & using it.
here what i'm facing problem is i'm not getting how it is connect to sql server for CURD operation.
please help me.

Sharanamma Jekeen
  • 881
  • 1
  • 8
  • 14
  • Unfortunately your question is not at all clear. You will need to be much more specific: what exactly are you trying to do, what have you already tried, what does the code causing the problem look like, do you have specific error message ets. – Pondlife May 26 '12 at 17:43

2 Answers2

2

If I understand corretly, you are asking about how to access data in SQL Server from Visual FoxPro for CRUD operations. The following code may help you understand how this can be done. UPDATE, DELETE, INSERT and stored procedures could also be used in this way.

LOCAL connectionString
connectionString = "Driver={SQL Server};Server=myServer;Database=myDB;Uid=myUserName;Pwd=myPassword;"

LOCAL sql
sql = "SELECT * FROM myTable"

LOCALconnHandle

connHandle = SQLSTRINGCONNECT(connectionString)
= SQLSETPROP(connHandle, 'asynchronous', .f.)
= SQLEXEC(connHandle, sql, 'myTable')
= SQLDISCONNECT(connHandle)

SELECT myTable
BROWSE
DaveB
  • 9,470
  • 4
  • 39
  • 66
1

In addition to Dave's good advice, you need to know how the existing application accesses the SQL data. VFP provides three ways to talk to a SQL back-end: SQL pass-through (SPT), remote views and cursoradapters. Your best bet is to use the same approach that's already in place.

Tamar

Tamar E. Granor
  • 3,817
  • 1
  • 21
  • 29