Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Sqlstringconnect and Advantage Database Server
Message
From
26/12/2002 16:37:54
Charlie Schreiner
Myers and Stauffer Consulting
Topeka, Kansas, United States
 
 
To
26/12/2002 14:55:39
Calvin Smith
Wayne Reaves Computer Systems
Macon, Georgia, United States
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00735915
Message ID:
00735944
Views:
12
Hi Calvin,
I was able to use the ODBC driver to get at Advantage data. I used remote views. However, some of the tables had more than 254 fields, so those remote views failed. By using the OLE DB provider, I was able to get at the data in a flexible way. Note the ConnectionString setting. My code looked like this:
LOCAL oRecordSet AS Object OF ADODB.RecordSet
oConnection=CREATEOBJECT("ADODB.connection")
WITH oConnection
   .Provider= "Advantage OLE DB Provider"
   .ConnectionString = "ServerType=ADS_LOCAL_SERVER"
   .Properties.Item["Data Source"].Value = "C:\PROGRAM FILES\SomeFolder"
   .Properties.Item["Advantage Server Type"].Value = "ADS_LOCAL_SERVER"
   .Open()
ENDWITH
oRecordSet = CreateObject("adodb.RecordSet")

CREATE TABLE AdvData (FileName C(10), FieldName C(30), Type N, Value C(60), RecNo N(4), VarType C(1))
DIMENSION aFileNames[2]
aFileNames[1] = "Table1"
aFileNames[2] = "Table2"

FOR EACH FileName IN aFileNames
   oRecordSet.Open("Select * From " +m.FileName, oConnection)
   IF oRecordSet.State = 1
      RecNo = 1
      DO WHILE NOT oRecordSet.EOF
         FOR x = 0 TO oRecordSet.Fields.Count-1
            FieldName = oRecordSet.Fields.Item[x].Name
            Type = oRecordSet.Fields.Item[x].Type
            VarType = VARTYPE(oRecordSet.Fields.Item[x].Value,.T.)
            Value = TRANSFORM(oRecordSet.Fields.Item[x].Value)
            INSERT INTO Schedules FROM MEMVAR
         ENDFOR
         oRecordSet.MoveNext()
         RecNo = m.RecNo + 1 
      ENDDO
   ENDIF
   oRecordSet.Close()
ENDFOR
>I need to be able to convert some data that is using the Advantage Database propriety file structure. I have the Advantage ODBC driver but cannot seem to configure the sqlstringconnect command to open the files. The Advantage database is using free tables and is local. If anyone can point out to me how to do this I will be muchly appreciative. Thanks! By the way, I am able to open the data using remote view.
Charlie
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform