Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Michael Kopljan
  Where is Michael Kopljan?
 Novi Sad
 Serbia
 Michael Kopljan
 To: dcNiko Vujke
  Where is dcNiko Vujke?
 Belgrade
 Serbia
 dcNiko Vujke
 Tags
Subject: RE: Using connection of CA
Thread ID: 268449 Message ID: 268679 # Views: 33 # Ratings: 0
Version: Visual FoxPro 9 SP2 Category: ODBC, ADO and OLEDB
Date: Tuesday, July 13, 2010 11:37:29 PM         
   


> Hi to everyone, I have a one question.
>
> If I have already created connection, can I use it for CA?
> I don't want to write a new connection string for CA like in the next code:
>
>
loConn=CREATEOBJECT('ADODB.Connection')
> loConn.ConnectionString=CS
> loConn.Open()
> 
> loCA.DataSourceType='ADO'
> loCA.DataSource=CREATEOBJECT('ADODB.Recordset')
> loCA.DataSource.ActiveConnection=loConn
> loCA.DataSource.CursorLocation=3
> loCA.DataSource.LockType=3
> 

>
> I saw a artical about CA and creating a new class of it, but can this be done programatically?

Yes, you can.

loRS = CREATEOBJECT('ADODB.Recordset')
loRS.Open("Select * From mytable", loConn, 1, 3)
loRS.ActiveConnection = .NULL.

loAdapter = CreateObject("CursorAdapter")
loAdapter.DataSourceType = "ADO" 
loAdapter.Alias = "Test1"
loAdapter.CursorFill(, , , loRS)


And you can detach cursor with
loAdapter.CursorDetach()


ENTIRE THREAD

Using connection of CA Posted by dcNiko Vujke @ 7/12/2010 11:27:25 AM
RE: Using connection of CA Posted by Cetin Basoz @ 7/12/2010 12:01:06 PM
RE: Using connection of CA Posted by dcNiko Vujke @ 7/12/2010 12:35:44 PM
RE: Using connection of CA Posted by Cetin Basoz @ 7/12/2010 2:05:00 PM
RE: Using connection of CA Posted by khubaib khalid @ 7/12/2010 2:48:56 PM
RE: Using connection of CA Posted by Cetin Basoz @ 7/12/2010 4:28:14 PM
RE: Using connection of CA Posted by dcNiko Vujke @ 7/12/2010 3:08:07 PM
RE: Using connection of CA Posted by Cetin Basoz @ 7/12/2010 4:27:01 PM
RE: Using connection of CA Posted by dcNiko Vujke @ 7/13/2010 8:43:08 AM
RE: Using connection of CA Posted by Cetin Basoz @ 7/13/2010 11:25:12 AM
RE: Using connection of CA Posted by Michael Kopljan @ 7/13/2010 11:37:29 PM
RE: Using connection of CA Posted by dcNiko Vujke @ 7/15/2010 11:03:43 AM