1

Konu: foxrprodan access veri tabanına bilgi kayıdı

foxrprodan access veri tabanına bilgi kayıdı yapabilen arkadaş varmı?kayıdı okuyorsun yazmaya gelince izin vermiyor.Üsdatların fikirlerini bekliyorum.

En büyük sermaye nakit,nakit sermaye vakittir...

2

Re: foxrprodan access veri tabanına bilgi kayıdı

Otururken bunu denedim normal yaziyor:

Visual Fox Pro
lcMDB = 'C:\Program Files\Microsoft Office\Office11\samples\NorthWind.Mdb'

lnHandle = SQLSTRINGCONNECT('Driver={Microsoft Access Driver (*.mdb)};Dbq='+;
m.lcMDB+';Uid=Admin;Pwd=;')
 
SQLExec(m.lnHandle,'select * from [Orders]','v_orders')
CursorSetProp('KeyFieldList','orderID','v_orders')
CursorSetProp('WhereType',1,'v_orders')
CursorSetProp('Tables','orders','v_orders')
 
CursorSetProp("UpdateNameList", ;
  "orderId  orders.OrderId,"+;
  "shipRegion orders.shipRegion",'V_orders')
 
CursorSetProp('UpdatableFieldList','shipRegion','v_orders')
CursorSetProp('SendUpdates',.T.,'v_orders')
CursorSetProp('Buffering',5,'v_orders')
 
BROWSE TITLE "ShipRegion editable"
Tableupdate(2,.T.,'v_orders')
SQLExec(m.lnHandle,'select * from [Orders]','afterupdate')
SQLDisconnect(m.lnHandle)
Select afterupdate
BROWSE TITLE "After Update"

3

Re: foxrprodan access veri tabanına bilgi kayıdı

eyvallah çetin üsdadım bende bir deneyeyim teşekkür ederim

En büyük sermaye nakit,nakit sermaye vakittir...

4 Son düzenleyen, cetinbasoz (04.07.2007 13:06:21)

Re: foxrprodan access veri tabanına bilgi kayıdı

Delete/Insert destekleyen versiyon:

Visual Fox Pro
lcMDB = 'C:\Program Files\Microsoft Office\Office11\samples\NorthWind.Mdb'

lnHandle = SQLSTRINGCONNECT('Driver={Microsoft Access Driver (*.mdb)};Dbq='+;
m.lcMDB+';Uid=Admin;Pwd=;')
 
SQLExec(m.lnHandle,'select * from [Orders]','v_orders')
CursorSetProp('KeyFieldList','orderID','v_orders')
CursorSetProp('WhereType',1,'v_orders')
CursorSetProp('Tables','orders','v_orders')
 
CursorSetProp("UpdateNameList", ;
  "orderId  orders.OrderId,"+;
  "customerID orders.CustomerID,"+;
  "orderDate orders.OrderDate,"+;
  "shipRegion orders.shipRegion",'V_orders')
 
CursorSetProp('UpdatableFieldList','orderID,customerID,orderDate,shipRegion','v_orders')
CursorSetProp('SendUpdates',.T.,'v_orders')
CursorSetProp('Buffering',5,'v_orders')
 
BROWSE TITLE "ShipRegion editable"
Tableupdate(2,.T.,'v_orders')
SQLExec(m.lnHandle,'select * from [Orders]','afterupdate')
SQLDisconnect(m.lnHandle)
Select afterupdate
BROWSE TITLE "After Update"

Ayni zamanda bunu da yapabilirisin:

Visual Fox Pro
lcMDB = 'C:\Program Files\Microsoft Office\Office11\samples\NorthWind.Mdb'

lnConnHandle = SQLSTRINGCONNECT('Driver={Microsoft Access Driver (*.mdb)};Dbq='+;
m.lcMDB+';Uid=Admin;Pwd=;')
 
lcSQL = "insert into [Orders] ([orderid],[RequiredDate]) values (?m.OrderID,?m.myDate)"
SQLPrepare(m.lnConnHandle, m.lcSQL)
 
for ix=1 to 5
  myDate = date()-m.ix
  OrderID = 30000 + m.ix
  SQLExec(m.lnConnHandle)
endfor
 
lcSQL = "update [Orders] set [OrderDate] = ?m.myDate where [OrderID] = ?m.OrderID"
SQLPrepare(m.lnConnHandle, m.lcSQL)
 
for ix=1 to 5
  myDate = date() - m.ix - 5
  OrderID = 30000 + m.ix
  SQLExec(m.lnConnHandle)
endfor
 
lcSQL = "delete from [Orders] where [OrderID] = ?m.OrderID"
OrderID = 30002
SQLExec(m.lnConnHandle, m.lcSQL)
SQLDisconnect(lnConnHandle)

5

Re: foxrprodan access veri tabanına bilgi kayıdı

Peki hocam ben de birşey sorsam. Access'den foxpro'ya nasıl aktarılır.
Bilemediğim için önce excelle ordandan foxa alıyorum. Access direk yazdığına göre ordan da okur sanırım. Ehh acemilik zor tabiii

6

Re: foxrprodan access veri tabanına bilgi kayıdı

Okumak her zaman daha kolay:)
Ilk kodda okuyor once, yazmak zorunda degil

Visual Fox Pro
lcMDB = 'C:\Program Files\Microsoft Office\Office11\samples\NorthWind.Mdb'

lnConnHandle = SQLSTRINGCONNECT('Driver={Microsoft Access Driver (*.mdb)};Dbq='+;
m.lcMDB+';Uid=Admin;Pwd=;')
 
SQLExec(m.lnConnHandle, "select * from [Orders]", "cevap")
SQLDisconnect(0)
 
select cevap
browse

7

Re: foxrprodan access veri tabanına bilgi kayıdı

Hocam çok teşekkür ederim, aynen okuyorum artık eski bilgilerimi smile Raporlarda çok işime yaradı.

Accesss dosyamda (kitap.mdb) sno,kitapadi,yazarı alanlarım var,( yaklaşık 1.500 kayıt )  bunları gene aynı alanları içeren kitap.dbf içine nasıl yazarım. Yani yapmaya çalıştığım kitap.mdb deki tüm bilgilerimi
kitap.dbf içine aktarmak. Böylelikle her zaman .mdb ile uğraşmak zorunda kalmam diye düşünüyorum. Galiba replace komutuyla olucak ama gene de emin değilim. Yoksa olaya yanlış yerden mi bakıyorum. Beni yönlendirirseniz sevinicem. Kod daha iyi olur ama takdir sizin şimdiden teşekkür ederim.

8

Re: foxrprodan access veri tabanına bilgi kayıdı

http://www.universalthread.com/Report.a … 49344B3954

Universalthread.com'dan bu link calisir mi emin degilim. Nolur nolmaz diye icerigini ayne buraya kopyeleyorum.
<B>MS Access MDB to VFP tables</B> FAQ #8039

MS Access MDB to VFP tables
Summary: Well it started when I found it hard to check rtf files for MSDN subscription index. In last few shipments there were also an MDB in 'UN-SUPPED' directory but my Access is too perfect to use an MDB < g > so I decided to get Access data to VFP tables.
Created by:   Cetin Basoz
Izmir



For anyone interested it's also a simple demonstration of converting MDB tables to VFP tables (Here in his particular case I was only dealing with tables, if you want you can access < bg > other as well - VIEW and SYSTEM TABLES. To do that you'd only change ['TABLE'] to something like ['TABLE','VIEW'] But be aware if you also include SYSTEM TABLES you get their names in myMDB cursor however you shouldn't try to execute following SQLEXEC on them).



Visual Fox Pro
lcDataBaseName = 'MSDN'

lcMDBDir = 'C:\My Documents\MSDN CD SUBCRIPTION INDEXES\UN-SUPPED'
lcMDBName = 'MSDN APRIL CD SUBCRIPTION INDEX.MDB'
lnConnHandle = SQLSTRINGCONNECT('DSN=MS Access Database;DBQ='+;
  lcMDBDir+'\'+lcMDBName+';DefaultDir='+;
  lcMDBDir+';DriverId=25;FIL=MS Access;MaxBufferSize=2048;'+;
  'PageTimeout=5;UID=admin;')
Create data (lcDataBaseName)
SQLTABLES(lnConnHandle, ['TABLE'], 'myMDB')
Select myMDB
Scan
  lcSQL = 'select * from "'+trim(table_name)+'"'
  lcCursor = chrtran(trim(table_name),' ','_')
  lcTableName = '_'+lcCursor
  SQLEXEC(lnConnHandle,lcSQL,lcCursor)
  Select (lcCursor)
  Copy to (lcTableName)
  Add table (lcTableName)
Endscan
SQLDISCONNECT(lnConnHandle)
Modi data

Once you have data in a VFP database you know what to do with it smile


Update - another sample for browsing an MDB content:

Visual Fox Pro
Public oForm

oForm = Createobject('myForm')
oForm.Show()
 
Define Class myForm As Form
  Height = 450
  Width = 850
  DataSession=2
  Caption='Show Access Data'
 
  Add Object lblAccess As Label With ;
    Caption = "Access Database", ;
    Left = 10, Top = 15, Width = 100
 
  Add Object txtMDBlocation As TextBox With ;
    Left = 112, Top = 12, Width = 520
 
  Add Object cmdBrowse As CommandButton With ;
    Top = 10, Left = 640, Caption = "Browse", Autosize=.t.
 
  Add Object lblTables As Label With ;
    Caption = "Tables", Left = 20, Top = 40, Width = 40
 
  Add Object lstTables As ListBox With ;
    Height = 400, Left = 65, Top = 40, Width = 265
 
  Add Object grdShow As Grid With ;
    Height = 400, Left = 340, Top = 40, Width = 500
 
  Procedure listtables
    Local lnConnHandle,lcMDB
    With This.txtMDBlocation
      If Empty(.Value) Or !File(.Value)
        Return
      Endif
      lcMDB = Trim(.Value)
    Endwith
 
    lnConnHandle = ;
     Sqlstringconnect("Driver={Microsoft Access Driver (*.mdb)};"+;
                     "Uid=Admin;DBQ="+m.lcMDB)
    SQLTABLES(m.lnConnHandle, ['TABLE'], 'crsTables')
    SQLDISCONNECT(m.lnConnHandle)
    Select crsTables
    This.lstTables.Clear()
    Scan
      This.lstTables.AddItem(crsTables.table_name)
    Endscan
  Endproc
 
 
  Procedure txtMDBlocation.LostFocus
    Thisform.listtables()
  Endproc
 
 
  Procedure cmdBrowse.Click
    This.Parent.txtMDBlocation.Value = Getfile('MDB','','',0,'Select Access Database')
    Thisform.listtables()
  Endproc
 
 
  Procedure lstTables.InteractiveChange
    Local lnConnHandle,lcMDB,lcSQL
    With This.Parent.txtMDBlocation
      If Empty(.Value) Or !File(.Value)
        Return
      Endif
      lcMDB = Trim(.Value)
    Endwith
 
    lcSQL = 'select * from "'+Trim(This.Value)+'"'
    lnConnHandle = ;
     Sqlstringconnect("Driver={Microsoft Access Driver (*.mdb)};"+;
                     "Uid=Admin;DBQ="+m.lcMDB)
    SQLEXEC(m.lnConnHandle,m.lcSQL,'crsLocal')
    SQLDISCONNECT(m.lnConnHandle)
    With This.Parent.grdShow
      .ColumnCount = -1
      .RecordSource = 'crsLocal'
    Endwith
  Endproc
Enddefine

More entries from this member


How can I get RGB(...) value from a color number? September 20, 2000
This will get you the RGB equivalent from a color number. These are 2 little functions doing it different ways. You may try which one fits better your needs. The first one uses the 256 syntax to get the color. The second one is using the BITAND and BITRSHIFT approach.

Images, containers in grid August 9, 2000
With grids it's a little problematic to show different images or container objects per row. You might have only image filenames stored in a table or you might want to show something like a time table with shape controls where you only store start-end values as numeric. Grid shows the same thing on all rows. Solution is a simple trick using Dynamic* properties. Dynamic* properties get evaluated each time a grid refresh is done and -thanks to Fox team- done only for visible cells. We'll get image ...

Interacting with Word, using wordbasic February 16, 1998
Here is two sample functions one is just for using wordbasic and the second is using wordbasic in mailmerge. Wordbasic PEMs are defined in wrdbasic.hlp located in winword directory. This help file contains the arguments as named arguments which are not suitable for calling via VFP. In files section there is a file called "positions.exe". It contains the "position.hlp" which in turn contains the correct argument positions suitable to pass as a parameter from VFP. function wordinsertdata * *...

Online database backups January 6, 1998
Databases have a little different header from tables thus making it impossible to copy them online through SQL or "copy to". The code below accomplishes this opening the DBC readonly and creating a copy of it using lowlevel IO. ****** * Please note that params are without extension, * no control for that ****** procedure DbBackupOnline lparameters cDbName, cNewName r1 = fopen(cDbName+".dbc") && Just readonly access r2 = fopen(cDbName+".dct") r3 = fopen(cDbName+".dcx") w1 = fcreat...

9

Re: foxrprodan access veri tabanına bilgi kayıdı

Access'ten tablolarini al ve aldigini VFP tablosu olarak sakla. Sonra Accessle ilisigini kes:)

SQL express bedava olduguna gore bu tablolarini SQL express'e almak ve bastan VFP+SQL server ile calismak daha akillica. Ufak islerde kulfet gelir ama uzun vadede en rahat yontem bence.

10

Re: foxrprodan access veri tabanına bilgi kayıdı

Hocam çok teşekkür ederim, hemen deneyip uygulamaya çalışacağım anlattıklarınızı.

11

Re: foxrprodan access veri tabanına bilgi kayıdı

teşekkürler hocam , artık tüm datam foxpro da .

12 Son düzenleyen, smentes (26.03.2010 11:13:21)

Re: foxrprodan access veri tabanına bilgi kayıdı

Çetin Bey

lcSQL = "insert into [Orders] ([orderid],[RequiredDate]) values (?m.OrderID,?m.myDate)"
SQLPrepare(m.lnConnHandle, m.lcSQL)

for ix=1 to 5
  myDate = date()-m.ix
  OrderID = 30000 + m.ix
  SQLExec(m.lnConnHandle)
endfor

Yukarıdaki sizin kodlarınızla dosyaya kayıt yapamıyorum. Delete ve browse çalışıyor. Kontro edebilir misiniz?

13

Re: foxrprodan access veri tabanına bilgi kayıdı

Yapamiyorun derken hata ne?

14

Re: foxrprodan access veri tabanına bilgi kayıdı

Uyguladığım örnekte delete ve browse bölümleri çalışıyor. Ama dosyaya insert ile kayıt yapmıyor. Döngü içindeki değerler dosyaya kaydedilmiyor.

15

Re: foxrprodan access veri tabanına bilgi kayıdı

Iyi de hata mesaji ne? Aerror() ile baktin mi?

Visual Fox Pro
if SQLExec( ... ) = -1

  aerror(aNeden)
  messagebox(  aNeden[2] )
endif

16

Re: foxrprodan access veri tabanına bilgi kayıdı

Visual Fox Pro
lcMDB = 'C:\Program Files\Microsoft Office\Office11\samples\NorthWind.Mdb'

lnHandle = SQLSTRINGCONNECT('Driver={Microsoft Access Driver (*.mdb)};Dbq='+;
m.lcMDB+';Uid=Admin;Pwd=;')
 
SQLExec(m.lnHandle,'select * from [Orders]','v_orders')
CursorSetProp('KeyFieldList','orderID','v_orders')
CursorSetProp('WhereType',1,'v_orders')
CursorSetProp('Tables','orders','v_orders')
 
CursorSetProp("UpdateNameList", ;
  "orderId  orders.OrderId,"+;
  "customerID orders.CustomerID,"+;
  "orderDate orders.OrderDate,"+;
  "shipRegion orders.shipRegion",'V_orders')
 
CursorSetProp('UpdatableFieldList','orderID,customerID,orderDate,shipRegion','v_orders')
CursorSetProp('SendUpdates',.T.,'v_orders')
CursorSetProp('Buffering',5,'v_orders')
 
BROWSE TITLE "ShipRegion editable"
Tableupdate(2,.T.,'v_orders')
SQLExec(m.lnHandle,'select * from [Orders]','afterupdate')
SQLDisconnect(m.lnHandle)
Select afterupdate
BROWSE TITLE "After Update"

Öncelikle Affınıza sığınarak denemelerime rağmen bir türlü bu kodla mdbye herhangi birşey kaydettiremedim yardım ederseniz çok sevinirim

17 Son düzenleyen, cetinbasoz (27.03.2010 13:54:19)

Re: foxrprodan access veri tabanına bilgi kayıdı

Hata mesaji ne? Nolur birisi de onu soylesin.

18

Re: foxrprodan access veri tabanına bilgi kayıdı

Ben şöyle denedim kendim bir veri tabanı oluşturdum çalışıyor görünüyor kod fakat herhangi bir şe kaydetmiyor veritabanına

19

Re: foxrprodan access veri tabanına bilgi kayıdı

Çetin bey geciktiğim için özür dilerim
komut büyük küçük harfe duyarlı imiş. ben alanları küçük harfle yazmıştım.
hata mesajındaki bilgiye göre alanları büyük harf yaptım. kayıt gerçekleşti.
teşekkürler.

20

Re: foxrprodan access veri tabanına bilgi kayıdı

Rica Etsem Tekrar Yazarmısınız Kodu

21

Re: foxrprodan access veri tabanına bilgi kayıdı

lcSQL = "insert into sattablo(SAT_SIRA,SAT_MT) values ('1','2')"
Bu satırdaki alan adlarını küçük harfle yazmıştım. Büyük harfle yazınca kayıt gerçekleşti.

22

Re: foxrprodan access veri tabanına bilgi kayıdı

buyuk kucuk aslinda farketmiyor ama i karakteri ozel. Yalnizca Turkce'de ı ve İ var. Ondan sapitiyor.

23

Re: foxrprodan access veri tabanına bilgi kayıdı

Peki Bir sorum daha olacak
Bu  Access veri tabanını internetteki sayfadaki veri tabanına kaydettirebilir miyim Acaba?

24

Re: foxrprodan access veri tabanına bilgi kayıdı

Arkadaşlar Bir Fikri Olan Yokmu ?

25

Re: foxrprodan access veri tabanına bilgi kayıdı

Bildiğim kadarı ile "evet". Kimi sitelerde  MYSQL yada "SQL SERVER" yerine veritabanı olarak Access kullanılıyor.

İnternet programcılığı ile hiç tecrübem yok. O yüzden örnek kod veremiyorum.

Uğur
-------------------------------------------------------------------------------------------------------------
Hayat bir bisiklete binmek gibidir. Pedalı çevirmeye devam ettiğiniz sürece düşmezsiniz. Claude Peppeer
Kusuru söylenmeyen adam, ayıbını hüner sanır.  Türk Atasözü