![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Can VBScript read foxpro 2.6 database? i have a system work in dos and foxpro 2.6 now i hope get that data on website can vbscript do that? and how? |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Can VBScript read foxpro 2.6 database? "C.K" <accin@xxxxxx> wrote in message news:eV4CLcjFKHA.4932@xxxxxx Quote: >i have a system work in dos and foxpro 2.6 > now i hope get that data on website > can vbscript do that? and how? > connection string. See this link for information on connection strings for FoxPro 2.x: http://www.connectionstrings.com/visual-foxpro I have no experience with FoxPro, but I would use ADO in code similar to below: ======== ' Connection string. In this case, the database is c:\myvfpdb.dbc. strConnect = "Driver={Microsoft Visual FoxPro Driver};" _ & "SourceType=DBC;" _ & "SourceDB=c:\myvfpdb.dbc;" _ & "Exclusive=No;" _ & "NULL=NO;" _ & "Collate=Machine;" _ & "BACKGROUNDFETCH=NO;" _ & "DELETED=NO;" ' Open a connection to the database. Set adoConnection = CreateObject("ADODB.Connection") adoConnection.ConnectionString = strConnect adoConnection.Open ' Query a table in the database. Set adoRecordset = CreateObject("ADODB.Recordset") Set adoRecordset.ActiveConnection = adoConnection adoRecordset.Source = "SELECT * FROM MyTable" adoRecordset.Open ' Enumerate the resulting recordset. ' Retrieve all fields for all rows. j = 0 Do Until adoRecordset.EOF j = j + 1 for k = 1 To adoRecordset.Fields.Count strValue = adoRecordset.Fields(k - 1).Value strName = adoRecordset.Fields(k - 1).Name Wscript.Echo j & ", " & k & ": " & strName & " = " & strValue Next adoRecordset.MoveNext Loop ' Clean up. adoRecordset.Close adoConnection.Close ======= My example above assumes you know a table name, but not the names of the fields, so it enumerates the names and values of all fields. Generally, you will know the names of the fields, so the query and recordset enumeration may be more similar to: ======== ' Query specific fields in specific rows. adoRecordset.Source = "SELECT FirstName, LastName FROM MyTable " _ & "WHERE RoomID = 34" Do Until adoRecordset.EOF strFirst = adoRecordset.Fields("FirstName").Value strLast = adoRecordset.Fields("LastName").Value Wscript.Echo strFirst & " " & strLast adoRecordset.MoveNext Loop ======= This demonstrates how a VBScript program can use ADO to read any database, if you can create a valid connection string, and you know something about the database. Getting this on a web site is another matter, and is up to you. I hope this helps. -- Richard Mueller MVP Directory Services Hilltop Lab - http://www.rlmueller.net -- |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| How to read sql server database properties | PowerShell | |||
| Read txt file and compare to database | VB Script | |||
| Cannot connect to FoxPro database in Vista, IIS 7 | General Discussion | |||
| interesting read> media player database | Vista General | |||
| I have a problem creating a ODBC connection to a Foxpro Database!! | Vista file management | |||