Sharanamma Jekeen
Sharanamma Jekeen

Reputation: 931

brief description about foxpro & sql connection

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.

Upvotes: 0

Views: 3125

Answers (2)

Tamar E. Granor
Tamar E. Granor

Reputation: 3937

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

Upvotes: 1

DaveB
DaveB

Reputation: 9530

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

Upvotes: 2

Related Questions