سؤال

How to connect remote oracle database 11g server in FoxPro?

هل كانت مفيدة؟

المحلول

It should be relatively simple provided you have the data provider installed.

I would start by looking at the connection string requirements

With that, you can get a handle to the database via

cConnectionString = "Driver = blah;Server=blah; etc from connection string website reference";
nHandle = SQLStringConnect( cConnectionString )

if nHandle < 1
   messagebox( "Unable to connect" )
   return
endif

*/ Once connected, you can then query the database
nResult = SQLExec( nHandle, "select * from yourTable", "cursorResultSentBackToVFPSide" )

if nResult < 1
   messagebox( "Error querying data" )
   return
endif

*/ If you need to parameterize something, a local variable in your routine can be used 
*/ and will be applied by using the "?" place-holder, such as

lnSomeIDYouWant = 1234
lcSQLCmd = "select * from SomeTable where SomeKey = ?lnSomeIDYouWant order by blah"
nResult = SQLExec( nHandle, lcSQLCmd, "C_VFPAlias" )

SQLDisconnect(nHandle)

The parameters can be of almost any type (except for things like general/binary which might need alternate measures, but the others like logical, numeric, date, string all no problems).

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top