الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

التعامل مع قواعد البيانات الاخرى Sql – Mysql – Mdb من خلال الفوكس برو

مثبّترائج
بدأه Shadowz في 11 أبريل 2009 · 58 رد · 14,964 مشاهدة · في قواعد بيانات Visual FoxPro
مشاركة: واتساب X فيسبوك تيليجرام
#26

مشكور اخي

وجزاك الله الف خير

#27

السلام عليكم

اخواني الاعزاء ممكن موقع استضافة مجاني لكي ارفع عليه قاعدة البيانات واتعامل من خلال الفيجوال فوكس مع قاعدة البيانات (sql server) لكي اختبر فاعليتها على النت

#28
barcaman17 كتب:

السلام عليكم

اخواني الاعزاء ممكن موقع استضافة مجاني لكي ارفع عليه قاعدة البيانات واتعامل من خلال الفيجوال فوكس مع قاعدة البيانات (sql server) لكي اختبر فاعليتها على النت

اخي العزيز يوجد العديد من مواقع قواعد البيانات المجانية والغير مجاني

وفعاليتها تعتمد علبى قوة الانترنت لديك اما بالنسبة للانترنت ذات السرعة العادية فهو بطيئ نسبيا

تحياتي للجميع

#29

سؤال؟؟

كيف يتم ربط قواعد بيانات MYSQL في موقع مع Application visualfox واجهة فوكس برو

ملحوظة:

اي موقع وليس بالتحديد موقع (www.db4free.net)

هل يمكن ذلك

لانه حاولت مع اكثر من موقع ولم استطع

#30

السلام عليكم

اخوتي و اخواتي الاعزاء

الحمد لله قمت بتصميم نظام بسيط يحوي الاساسيات (اتصال بقاعدة البيانات - اضافة - تعديل - حذف - بحث - عرض- تقرير)

باستخدام الفيجوال فوكس برو ولغة sql (قاعدة بيانات موجودة على سيرفر sql 2005)

اود ان استفسر عن اساليب رفع قاعدة البيانات على لنت وجعلها فعالة بحيث استطيع التحكم بالبيانات من حاسوب اخر ؟؟؟؟؟

#31
barcaman17 كتب:

السلام عليكم

اخوتي و اخواتي الاعزاء

الحمد لله قمت بتصميم نظام بسيط يحوي الاساسيات (اتصال بقاعدة البيانات - اضافة - تعديل - حذف - بحث - عرض- تقرير)

باستخدام الفيجوال فوكس برو ولغة sql (قاعدة بيانات موجودة على سيرفر sql 2005)

اود ان استفسر عن اساليب رفع قاعدة البيانات على لنت وجعلها فعالة بحيث استطيع التحكم بالبيانات من حاسوب اخر ؟؟؟؟؟

اخي العزيز

انتظرني سوف اقوم بارفاق مثال حي عن التحكم بقواعد البيانات مع sql من خلال النت

وان شاء الله الاسبوع المقبل اي يوم الاحد ان شاء الله لعدم توفر النت في منزلي

واتمنى انك تجد ماتريد

تحياتي للجميع

#32

السلام عليكم

اخواني الاعزاء

لدي استفساران قد عذباني جدا الاول كيف يتم الاتصال من الفيجوال فوكس موجود في حاسوب بقاعدة بيانات اوراكل موجودة على سيرفر او حاسب اخر والسؤال الثاني حمدا لله باني قد نجحت بالربط بين واجهة فوكس برو وقاعدة بيانات اوراكل موجودين في نفس الحاسوب لكن المشكلة التي واجهتني عند اضافة قيد فانه يضيف المتغيرات الرقمية فقط اما الحرفية فلا يضيفها

كما في الشفرة ادناه

عند استخدام هذه الشفرة فانه لايتم اضافة اي شي

y=SQLEXEC(con,'insert into master_mm (c_name) values (?b)

اما عند استخدام الشفرة ادناه فتتم الاضافة بصورة طبيعية

y=SQLEXEC(con,'insert into master_mm (c_stfno) values (?a)

للعلم بان c_name هو حرفي اما c_stfno فهو رقمي

ولكم جزيل الشكر

#33

هل من مجيب؟؟؟؟؟

#34

السلام عليكم ورحمة الله وبركاته،،

alaaqasem كتب:

الابناء الاعزاء

تحياتى وشكرى واعجابى بجهودكم وعلمكم بخصوص الموضوع بعاليه أتمنى منكم عمل فورم على هيئة ويزارد يضع فيه المستخدم اسم السيرفر واليوزر وكلمة السر واى بيانات لازمة لعمل الارتباط ثم بعد ملء المتغيرات نضغط Run فيتم تنفيذ الارتباط المرجو وأسال الله أن يجعل هذا فى ميزان حسناتكم ولقد كان اعجبنى جدا مثال مثل هذا تم انشاءة بهذا الموقع منذ سنوات واستفدت منه كثيرا وارى انه من الممكن عمل تحسينات علية بحيث ياخد شكل شبه مكتبى يحتفظ به كل من يريد استخدامة ومرفق البرنامج الذى اتكلم عنه واسال الله ان يجعل كل جهودكم فى ميزان حسناتكم

عزيزي المهندس علاء....يرجى ذكر رابط المثال عسى أن نكمل عليه...مع التحية

barcaman17 كتب:

السلام عليكم

اخواني الاعزاء

لدي استفساران قد عذباني جدا الاول كيف يتم الاتصال من الفيجوال فوكس موجود في حاسوب بقاعدة بيانات اوراكل موجودة على سيرفر او حاسب اخر والسؤال الثاني حمدا لله باني قد نجحت بالربط بين واجهة فوكس برو وقاعدة بيانات اوراكل موجودين في نفس الحاسوب لكن المشكلة التي واجهتني عند اضافة قيد فانه يضيف المتغيرات الرقمية فقط اما الحرفية فلا يضيفها

كما في الشفرة ادناه

عند استخدام هذه الشفرة فانه لايتم اضافة اي شي

y=SQLEXEC(con,'insert into master_mm (c_name) values (?b)

اما عند استخدام الشفرة ادناه فتتم الاضافة بصورة طبيعية

y=SQLEXEC(con,'insert into master_mm (c_stfno) values (?a)

للعلم بان c_name هو حرفي اما c_stfno فهو رقمي

ولكم جزيل الشكر

العزيز barcaman17

ما هي رسالة الخطأ التي تظهر لديك ؟

جرب وضع المتغير بين علامتي تنصيص...عل وعسى

مع التحية

أستغفر الله العظيم و أتوب إليه

#35

الاخ العزيز shadowz لاتظهر اي رسالة خطا وهذا ماحيرني وقد جربت كل الطرق حتى الاستدعاء من خلال الماكرو (&) لكن لم ينجح اي منها وانا في حيرة من امري ؟؟!!

#36

جرب الطريقة التالية

TEXT TO cAnyVariable TEXTMERGE NOSHOW PRETEXT 15
	insert into Master_MM (c_Name, stFNo) values ('<<B>>', <<A>>)
ENDTEXT
MESSAGEBOX(cAnyVariable)
IF SQLEXEC(Con, cAnyVariable ) < 1
	AERROR(Err)
	MESSAGEBOX(Err(2))
ELSE
	MESSAGEBOX('Ok')
ENDIF

طبعا المتغيرات وضعت بناءاً على مثالك

تم تعديل هذه المشاركة بواسطة Shadowz في 20 نوفمبر 2012 في 22:35

أستغفر الله العظيم و أتوب إليه

#37

شكرا جزيلا على الاجابة

سيتم تجربة الشفرة واخباركم بالنتائج مع التقدير

بالمناسبة ماذا عن الاستفسار الاول (لدي استفساران قد عذباني جدا الاول كيف يتم الاتصال من الفيجوال فوكس موجود في حاسوب بقاعدة بيانات اوراكل موجودة على سيرفر او حاسب اخر)

#38

للاتصال بقاعدة بيانات على جهاز آخر

ضع الـ IP Address الخاص بجهاز السيرفر الذي تريد الاتصال به في جملة الربط

واذا لم يفلح هذا...ضع الكود هنا لرؤيته

أستغفر الله العظيم و أتوب إليه

#39

الاخ العزيز shadows

لم تفلح كل التجارب لادراج نص من واجهة الفيجوال فوكس الى قاعدة بيانات اوراكل

مع التقدير

#40
barcaman17 كتب:

الاخ العزيز shadows

لم تفلح كل التجارب لادراج نص من واجهة الفيجوال فوكس الى قاعدة بيانات اوراكل

مع التقدير

اخي العزيز

ارفق كود الذي لايتم كما طلب منك الاخ عبدالله

تحياتي للجميع

#41

السلام عليكم

الاخ shadows والاخ lion iraq

كل الشكر و التقدير على المساعدة وسرعة الاستجابة بالنسبة للشفرة التي كتبها الاخ shadows مضبوطة 100% وفعالة

والحمد لله تم العمل بها واود اعلامكم بانه السبب في عدم عمل الشفرة لاول مرة هو كتابة جملة insert to بسطرين تفصل بينهما

فاصلة منقوطة (:) كما في فيجوال فوكس برو وهو غير مقبول عند استخدام اس كيو ال

و اود ان انوه الى ان تجربة ربط نموذج فيجوال فوكس مع قاعدة بيانات الاوراكل هي تجربة ناجحة بكل المقاييس واتمنى من المبرمجين

العمل بها وتطويرها للوصول الى انظمة متكاملة ولكي نرد بها على كل المشككين في قدرات اللغة العظيمة (فيجوال فوكس)

مع تمنياتي لكم بالصحة والسلامة واثراء هذا المنتدى الرائع بالمعلومات القيمة

#42
barcaman17 كتب:

السلام عليكم

الاخ shadows والاخ lion iraq

كل الشكر و التقدير على المساعدة وسرعة الاستجابة بالنسبة للشفرة التي كتبها الاخ shadows مضبوطة 100% وفعالة

والحمد لله تم العمل بها واود اعلامكم بانه السبب في عدم عمل الشفرة لاول مرة هو كتابة جملة insert to بسطرين تفصل بينهما

فاصلة منقوطة (:) كما في فيجوال فوكس برو وهو غير مقبول عند استخدام اس كيو ال

و اود ان انوه الى ان تجربة ربط نموذج فيجوال فوكس مع قاعدة بيانات الاوراكل هي تجربة ناجحة بكل المقاييس واتمنى من المبرمجين

العمل بها وتطويرها للوصول الى انظمة متكاملة ولكي نرد بها على كل المشككين في قدرات اللغة العظيمة (فيجوال فوكس)

مع تمنياتي لكم بالصحة والسلامة واثراء هذا المنتدى الرائع بالمعلومات القيمة

اخي العزيز الحمد لله

ولكن اطلب منك ايضا كتابة الايعاز او كود الربط

للتوضيح للزائرين والاعضاء

تحياتي للجميع

#43

هذا الكود الذي عملت به

TEXT TO AHM2 TEXTMERGE NOSHOW PRETEXT 15

insert into Master_MM (C_STFNO,C_NAME,C_DEPTNO,C_DSGNO,C_WRKLOCNO,C_EDUCNO,c_grop,c_stat,C_SALARY) VALUES (<<A>>,'<<B>>','<<C>>','<<D>>','<<E>>','<<F>>',<<G>>,<<H>>,<<I>>)

ENDTEXT

MESSAGEBOX(AHM2)

IF SQLEXEC(Con, AHM2 ) < 1

AERROR(Err)

MESSAGEBOX(Err(2))

ELSE

MESSAGEBOX('Ok')

ENDIF

#45

اولاً:

الشكر لكل القائمين على هذا المنتدى وللمشرفين الذين افادونا بمعلوماتهم

ثانياً:

ارجو من اساتذة الفوكس برو شرح هذه الاوامر لاتعلقها  بهذا الموضوع

1- SQLSETPROP

2-SQLGETPROP

3-CURSORGETPROP

ما وظيفة هذه الاوامر وما عملها؟

 

معا خالص الشكر

nowfal Yassin

تم تعديل هذه المشاركة بواسطة nowfal_yassin_saif في 14 أبريل 2013 في 13:23

#46


اخي العزيز مفهومهم بشكل عام ومختصر
 

1- SQLSETPROP:يلغي الاجراءات والتغييرات الذي يتم اجراءها في الاتصال الحالي.

2-SQLGETPROP:يقوم بالضبط الافتراضي او المصنعي للاتصال نشط.

3-CURSORGETPROP:استدعاء او اعادة تجديد خصائص للجداول والمؤشرات .

ويمكن عرض الامثلة الافتراضية لمعرفة العمل بصورة اوسع

تحياتي للجميع

#47

السلام عليكم

اسمحوا لي بالتوضيح التالي

 

SQLSETPROP

 

يستخدم لتحديد بعض الخصائص المتعلقة بالاتصال الحالي ( موجودة كلها بملفات المساعدة بالفوكس )

 

SQLGETPROP

 

يستخدم لمعرفة الوضع الحالي لخصائص الاتصال الحالي، والتي قد يتم تحديدها بالأمر SQLSETPROP

 

 

 

CURSORSETPROP

 

يستخدم لتغيير بعض الخصائص الخاصة بالجدوال سواء الدائمة أو المؤقتة ( موجودة كلها بملفات المساعدة بالفوكس )

 

CURSORGETPROP

 

يستخدم لمعرفة حالة خصائص الجدول، التي قد يتم تحديدها بالأمر CURSORSETPROP

أستغفر الله العظيم و أتوب إليه

#48

السلام عليكم وتحياتي للاخ شادو المبدع 

اخوتي الكرام اذا كنتم  قراتم مشاركتي قبل الاخير ومشاركة الاخ شادو فتاكدو  انه لا يوجد اختلاف كما اتصل بي احد الاعضاء وذكر ان كلامك او كلام شادو متناقضان  بارك الله فيه واتمنى من الجميع اي يعبروا عن تسالهم 

حبيت ان اذكر الخصائص للادوات والامثله عليها من المصدر اي كما شرحها فيجوال فوكس برو 

اولا:SQLSETPROP( ) Function

Specifies settings for an active connection. You can use SQLSETPROP( ) to specify settings at the connection level. To specify Visual FoxPro default settings at the environment level, include 0 as the statement handle. 
SQLSETPROP(nStatementHandle, cSetting [, eExpression])
Parameters nStatementHandle
Specifies the statement handle to the data source returned by SQLCONNECT( ).
cSetting
Specifies the setting. The following table lists the values for cSetting.
Asynchronous
Specifies whether result sets are returned synchronously (False (.F.), the default), or asynchronously (True (.T.)). Read/write.
BatchMode
Specifies whether SQLEXEC( ) returns result sets all at once (True (.T.), the default), or individually with SQLMORERESULTS( ) (False (.F.)). Read/write.
ConnectBusy
Contains True (.T.) if a shared connection is busy; otherwise contains False (.F.). Read-only.
ConnectString
The login connection string. Read-only.
ConnectTimeOut
Specifies the time to wait (in seconds) before returning a connection time-out error. If you specify 0, the wait is indefinite and a time-out error is never returned. ConnectTimeOut can be 0 to 600. The default is 15. Read/write.
DataSource
The name of the data source as defined in the ODBC.INI file. Read/write.
DisconnectRollback
Specifies if a pending transaction is committed or rolled back when SQLDISCONNECT( ) is called for the last connection handle.
The default is false (.F.), indicating that a pending transaction is committed when SQLDISCONNECT( ) is called for the last connection handle.
Specify true (.T.) to roll back a pending transaction when SQLDISCONNECT( ) is called for the last connection handle.
Connections with automatic transaction processing are not affected by this setting.
Read/write.
DispLogin
Contains a numeric value that determines when the ODBC Login dialog box is displayed. DispLogin may assume the following values:
1 or DB_PROMPTCOMPLETE (from FOXPRO.H).1 is the default.
2 or DB_PROMPTALWAYS (from FOXPRO.H).
3 or DB_PROMPTNEVER (from FOXPRO.H).
If 1 or DB_PROMPTCOMPLETE is specified, Visual FoxPro displays the ODBC Login dialog box only if any required information is missing.
If 2 or DB_PROMPTALWAYS is specified, the ODBC Login dialog box is always displayed, making it possible for you to change settings before connecting.
If 3 or DB_PROMPTNEVER is specified, the ODBC Login dialog box isn't displayed and Visual FoxPro generates an error if the required login information isn't available. Read/write.
DispWarnings
Specifies if error messages are displayed (True (.T.)) or are not displayed (False (.F.), the default). Read/write.
IdleTimeout
The idle timeout interval in minutes. Active connections are deactivated after the specified time interval. The default value is 0 (wait indefinitely). Read/write.
ODBChdbc
The internal ODBC connection handle, which may be used by external library files (FLL files) to call ODBC. Read-only.
ODBChstmt
The internal ODBC statement handle, which may be used by external library files (FLL files) to call ODBC. Read-only.
PacketSize
The size of the network packet used by the connection. Adjusting this value can improve performance. The default value is 4096 bytes (4K). Read/write
Password
The connection password. Read-only.
QueryTimeOut
Specifies the time to wait (in seconds) before returning a general time-out error. If you specify 0 (the default), the wait is indefinite and a time-out error is never returned. QueryTimeOut can be 0 to 600. Read/write.
Shared
Specifies whether the underlying connection is a shared connection (True (.T.)), or not (False (.F.)).
Read-only.
Transactions
Contains a numeric value that determines how the connection manages transactions on the remote table. Transactions may assume the following values:
1 or DB_TRANSAUTO (from FOXPRO.H).1 is the default. Transaction processing for the remote table is automatically handled.
2 or DB_TRANSMANUAL (from FOXPRO.H). Transaction processing is handled manually through SQLCOMMIT( ) and SQLROLLBACK( ). Read/write.
UserId
The user identification. Read-only.
WaitTime
The amount of time in milliseconds that elapses before Visual FoxPro checks if the SQL statement has completed executing. The default is 100 milliseconds. Read/write.

eExpression
Specifies the value for the setting you designate with cSetting. If you omit eExpression, the default value is restored for the setting.
Return Value
Numeric data type. SQLSETPROP( ) returns 1 if it is successful. Otherwise, it returns – 1 if a connection level error occurs or – 2 if an environment level error occurs.
Remarks
You can use SQLGETPROP( ) to return the current value for a specified setting.
Note
You must disable the Open Database Connectivity (ODBC) login dialog box to support SQL pass through with Microsoft Transaction Server. To disable the ODBC login dialog box, use the statement SQLSETPROP(cStatementHandle, 'DispLogin', 3), where cStatementHandle is the statement handle returned by SQLCONNECT( ). You can also disable the ODBC login dialog box in the Connection Designer.
The ConnectTimeOut option can be set only at the Visual FoxPro level and has no equivalent at the connection level. You can set all other options at either the connection or the Visual FoxPro level. Each option set at the Visual FoxPro level serves as a default value for subsequent connections.
Example
The following example shows how SQLSETPROP( ) is used to set the packet size for the current connection. SQLCONNECT( ) displays the Select Connection or Data Source Dialog Box for you to choose a connection, and
the connection is tested. The packet size is set; the setting is tested; and the results are displayed.
CLOSE ALL

CLEAR ALL

CLEAR

nHandle=SQLCONNECT()

IF nHandle > 0

   nSet=SQLSETPROP(nHandle, "PacketSize", 2048 )

   IF nSet > 0

      =MESSAGEBOX("PacketSize was set to 2048",0,"Connection Results")

   ELSE

      =MESSAGEBOX("Error setting PacketSize",0,"Connection Results")

   ENDIF

ELSE

   =MESSAGEBOX("No Connection",0,"Connection Results")

ENDIF

=SQLDISCONNECT(nHandle)

 يتبع>>>>>>>>>>>>>

تم تعديل هذه المشاركة بواسطة lion iraq في 20 يونيو 2013 في 19:41

#49

ثانيا:SQLGETPROP( ) Function

Retrieves the current or default settings for an active connection.

 

SQLGETPROP(nStatementHandle, cSetting)
 


Parameters
nStatementHandle 
Specifies the statement handle to the data source returned by SQLCONNECT( ). If you specify 0 for nStatementHandle, SQLGETPROP( ) returns the environment setting.

cSetting 
Specifies the setting. For a list of the settings you can specify, see SQLSETPROP( ) Function.

Return Value
Character, Numeric, or Logical data type. SQLGETPROP( ) returns the current or default settings for an active connection. SQLGETPROP( ) returns -1 if a connection level occurs and -2 if an environment level error occurs.

imageExample
The following example uses SQLCONNECT( ) to display the Select Connection or Data Source Dialog Box. Choose a data source, the data source connection is tested, and the example displays the results using SQLGETPROP( ) and the cSetting for the data source.
CLOSE ALL

CLEAR ALL

CLEAR

nHandle=SQLCONNECT()

IF nHandle > 0

 cSource= SQLGETPROP(nHandle, "datasource")

 =MESSAGEBOX("Current Data Source = "+cSource,0,"Connection Results")

ELSE

 =MESSAGEBOX("Connection Error = " + ;

  ALLTRIM(STR(nHandle)),0,"Connection Results")

ENDIF

=SQLDISCONNECT(nHandle)

يتبع >>>>>>>>>

#50

ثالثا :CURSORSETPROP( ) Function

Specifies property settings for a Visual FoxPro table or a cursor.

 

CURSORSETPROP( cProperty [, eExpression] [,cTableAlias | nWorkArea])
 


Parameters
cProperty 
Specifies the table or cursor property to set. Buffering is the only property you can specify for a Visual FoxPro table.

eExpression 
Specifies the value for the property you specify with cProperty. If you omit eExpression, the property is set to its default value.

The following table lists the properties you can specify for cProperty and a description of the values eExpression can assume.

Property  eExpression values  
AllowSimultaneousFetch
 Applies when using remote views, a shared connection, and to cursors created using ODBC. 

.T. - Permit similarly configured cursors sharing the connection to fetch rows simultaneously. 

.F. - Do not permit similarly configured cursors sharing the connection to fetch rows simultaneously.
 
AutoIncError
 .T. - Generate an error message when attempting to insert or update values in a field that uses automatically incrementing field values. 

.F. - Does not generate an error message but does not use the value specified when attempting to insert or update the value in a field that uses automatically incrementing field values, which uses the appropriate incremented value.

Applies to cursors and sessions.
 
BatchUpdateCount*
 Specifies the number of update statements to send to the remote data source for buffered tables. The default value is 1. Adjusting this value can greatly increase update performance when using automatic updating.
 
Buffering
 1 – Sets row and table buffering off. Record locking and data writing are identical to earlier FoxPro versions. (Default)

2 – Sets pessimistic row buffering on.

3 – Sets optimistic row buffering on.

4 – Sets pessimistic table buffering on.

5 – Sets optimistic table buffering on. SET MULTILOCKS must be ON for all Buffering modes except 1 (off).
 
CompareMemo
 .T. - Include memo fields of type Memo, General, or Picture in the WHERE clause for updates. 

.F. – Do not include memo fields in the WHERE clause for updates.

Applies when automatic updating is used.
 
FetchAsNeeded
 .T. – Fetch records only when needed, such as when record pointer moves to a row that has not been fetched.

.F. – Fetch additional data during idle time.

NoteNote  
FetchAsNeeded does not apply when progressive fetching is disabled (FetchSize is -1).
 
 
FetchMemo*
 .T. – Fetch memo fields with the view results. 

.F. – Do not fetch memo fields with the view results.
 
FetchSize*
 Specifies the number of rows progressively fetched from the remote table result set. The default value is 100 rows. Setting FetchSize to –1 retrieves the complete result set, limited by the MaxRecords setting.

NoteNote  
Progressive fetching holds the connection until all rows are retrieved. Use caution coding with FetchSize if ShareConnection is True (.T.).
 
 
KeyFieldList
 Specifies a comma-delimited list of primary fields for the cursor. No default. You must include a list of field names for updates to work when using automatic updating.
 
MapBinary
 .T. - At the session level, SQL Pass-Through maps SQL_BINARY, SQL_VARBINARY, and SQL_LONGVARBINARY ODBC types to Varbinary or Blob data type.

For remote views, the CREATE SQL VIEW command maps the SQL_LONGVARBINARY ODBC data source type to Blob type, and it maps SQL_BINARY and SQL_VARBINARY ODBC data source types to Varbinary type when the precision of the corresponding column in the data source is less than or equal to 254 bytes. When precision is greater than 254 bytes, these types map to Blob type. 

.F. - SQL Pass-Through maps SQL_BINARY and SQL_VARBINARY ODBC types to Character type. (Default)

For remote views, the CREATE SQL VIEW command maps SQL_BINARY and SQL_VARBINARY ODBC data source types to Memo type.

NoteNote  
MapBinary is read/write for nWorkArea set to 0, read-only for SQL Pass-Through cursors, and invalid for table cursors (nWorkArea equal to or greater than 1).
 
 
MapVarchar
 .T. - At the session level, SQL Pass-Through maps SQL_WVARCHAR and SQL_VARCHAR ODBC types to Varchar type. 

For remote views, CREATE SQL VIEW command maps SQL_WVARCHAR and SQL_VARCHAR ODBC data source types to Varchar type.

.F. - SQL Pass-Through maps SQL_WVARCHAR and SQL_VARCHAR ODBC types to Character type. (Default)

For remote views, CREATE SQL VIEW command maps SQL_WVARCHAR and SQL_VARCHAR ODBC data source types to Character type.

NoteNote  
MapVarchar is read/write for nWorkArea set to 0, read-only for SQL Pass-Through cursors, and invalid for table cursors (nWorkArea equal to or greater than 1).
 
 
MaxRecords*
 Specifies the maximum number of rows fetched when returning result sets. The default value is – 1, and all rows are returned. A value of 0 specifies that the view is executed but no results are fetched.
 
ParameterList
 Specifies a semi-colon delimited list of view parameters and parameter types. For views only.
 
Prepared
 .T. - Prepare SQL statements for subsequent REQUERY( ) function calls. 

.F. - Do not prepare SQL statements for subsequent REQUERY( ) calls. (Default).

REQUERY( ) is used to retrieve data again for a SQL view. For additional information about preparing SQL statements, see SQLPREPARE( ) Function.
 
Refresh
 Specifies a numeric refresh value for an individual cursor in the current data session or an initial refresh value for newly opened cursors in the current data session.

Use the SET DATASESSION Command to select a specific data session, and use the cTableAlias or nWorkArea parameter to specify a specific cursor. Use nWorkArea = 0 to change the initial refresh value for all newly opened cursors. Any cursors that are already open will not be affected by the new refresh setting.

SET REFRESH Command allows you to specify a global refresh value. By default, the CURSORSETPROP( ) Refresh setting is -2, which indicates that the current global SET REFRESH value is used. The global SET REFRESH value is specified with its second parameter, nSeconds2.

You can set the CURSORSETPROP( ) Refresh setting to the same values as the nSeconds2 parameter in SET REFRESH.

Note   The CURSORSETPROP( ) Refresh setting will be ignored if the nSeconds2 parameter is currently set to zero in the SET REFRESH command.
 
SendUpdates
 .T. – Specifies that a SQL update query is sent to update tables when an update is made using the view.

.F. – Specifies that a SQL update query is not sent to update tables.
 
Tables
 Specifies a comma-delimited list of the names of remote tables. No default. You must include a list of table names for updates to work when using automatic updating.
 
UpdatableFieldList
 Specifies a comma-delimited list of fields in the view. This list can include fields from local and remote tables. You must include a list of fields for updates to work when using automatic updating.
 
UpdateNameList
 Specifies a comma-delimited list of remote field names and the local field names assigned to the cursor. Use this option to specify valid Visual FoxPro names for fields in the cursor that have invalid Visual FoxPro field names.
 
UpdateType
 1 – Update old data with new data. (Default)

2 – Update by deleting old data and inserting new data.
 
UseMemoSize*
 Specifies the minimum size in bytes for result columns to return in memo fields. For example, if the width of a column result is greater than the value of UseMemoSize, the column result is stored in a memo field. UseMemoSize can vary from 1 to 255 bytes. The default value is 255 bytes.
 
WhereType
 The WHERE clause for updates to remote tables. WhereType can assume the following values:

1 or DB_KEY (from FOXPRO.H). The WHERE clause used to update remote tables consists of only the primary fields specified with the KeyFieldList property.

2 or DB_KEYANDUPDATABLE (from FOXPRO.H). The WHERE clause used to update remote tables consists of the primary fields specified with the KeyFieldList property and any updatable fields.

3 or DB_KEYANDMODIFIED (from FOXPRO.H). The WHERE clause used to update remote tables consists of the primary fields specified with the KeyFieldList property and any other fields that are modified. (Default)

4 or DB_KEYANDTIMESTAMP (from FOXPRO.H). The WHERE clause used to update remote tables consists of the primary fields specified with the KeyFieldList property and a comparison of the time stamps.
 

* This property is primarily used for remote views; setting it has no effect on local views. However, you can preset this property for local views that will be upsized.

cTableAlias 
Specifies the alias of the table or cursor for which the property is set.

nWorkArea 
Specifies the work area of the table or cursor for which the property is set. If you specify 0 for nWorkArea, CURSORSETPROP( ) sets the environment setting used for all subsequent tables or cursors.

NoteNote  
Buffering is not applied to tables that are opened implicitly, for example, using SQL INSERT/UPDATE/DELETE commands.
 

Return Value
Logical data type. CURSORSETPROP( ) returns True (.T.) if Visual FoxPro successfully sets the property you specify. Visual FoxPro generates an error if the property you specify cannot be set.

Remarks
The setting of the Buffering property for CURSORSETPROP( ) determines how Visual FoxPro performs record locking and update buffering. For additional information about record locking and update buffering, see How to: Buffer Data.

The setting of the WhereType property for CURSORSETPROP( ) determines how updates are performed on remote tables. For additional information about remote table updates, see Developing Databases.

You can use CURSORSETPROP( ) to override the FetchSize property in the SQLSETPROP( ) function for a cursor. This property is inherited from the cursor's connection handle by default. 

Use CURSORGETPROP( ) to return the current property settings for a Visual FoxPro table or a cursor created for a table.

If CURSORSETPROP( ) is issued without the optional cTableAlias or nWorkArea arguments, the property setting is specified for the open table or cursor in the currently selected work area.

Example
When a cursor is opened, the default value for the AutoIncError property is read from the session default value, which is the current default data session setting. The following example shows how you can set the default AutoIncError value for each session by specifying 0 (default session) as the last parameter:
CURSORSETPROP("AutoIncError", .T., 0)
The default session is used when opening a new private data session or cursor. The following example shows how you can set the cursor or table AutoIncError setting for each table by using the cTableAlias or nWorkArea parameter as the last parameter:
CURSORSETPROP("AutoIncError", .F. , cTableAlias | nWorkArea )
The following example demonstrates how you can enable optimistic table buffering with CURSORSETPROP( ). MULTILOCKS is set to ON, a requirement for table buffering. The "Customer" table in the "testdata" database is opened, and CURSORSETPROP( ) is used to set the buffering mode to optimistic table buffering (5). A message box is displayed showing the result of the operation.
CLOSE DATABASES

CLEAR



SET MULTILOCKS ON

OPEN DATABASE (HOME(2) + 'data\testdata')

USE Customer     && Open Customer table.



* Set buffering mode and store logical result

lSuccess=CURSORSETPROP("Buffering", 5, "Customer")

IF lSuccess = .T.

   =MESSAGEBOX("Operation successful!",0,"Operation Status")

ELSE

   =MESSAGEBOX("Operation NOT successful!",0,"Operation Status")

ENDIF

يتبع >>>>>>>>>>>>

مواضيع مشابهة