• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 676
  • Last Modified:

FileMaker Pro and ASP

Can anyone give me the syntax to connect to a FileMaker Pro database using ASP (vbscript)?

Can one even do it?  I have the FM ODBC drivers and created a system DSN.

Thanks!
0
marija
Asked:
marija
1 Solution
 
drittichCommented:
Sure.  Once you have created the system DSN, do this:

<%
Dim cn, rs, sql
Set cn = Server.CreatObject("ADODB.Connection")
sql = "SELECT Name FROM Users"
Set rs = cn.Execute(sql)
Do Until rs.EOF
     Response.Write rs("Name") & "<br>"
     rs.MoveNext
Loop
rs.Close
Set rs = Nothing
cn.Close
Set cn = Nothing
%>
0
 
drittichCommented:
Oops, should be this:

<%
Dim cn, rs, sql
Set cn = Server.CreatObject("ADODB.Connection")
cn.Open YourDSN
sql = "SELECT Name FROM Users"
Set rs = cn.Execute(sql)
Do Until rs.EOF
     Response.Write rs("Name") & "<br>"
     rs.MoveNext
Loop
rs.Close
Set rs = Nothing
cn.Close
Set cn = Nothing
%>
0
 
robbertCommented:
There is a knowledgebase article on that:
HOWTO: Connect to FileMaker Pro from Visual Basic with ODBC
http://support.microsoft.com/support/kb/articles/Q281/7/55.ASP

The VB code from there translated to VBScript is:

    Set cn = Server.CreateObject("ADODB.Connection")
    Set rs = Server.CreateObject("New ADODB.Recordset")

    cn.Open "Provider=MSDASQL.1;Data Source=FMTest;database=Sample02.fp5"
    cn.CursorLocation = adUseClient
    rs.Open "Select * from Sample02.fp5", cn
   
    For counter = 0 To rs.Fields.Count - 1
        Response.Write rs.Fields(counter).Name & "<br>"
    Next counter

    Do While Not rs.EOF
        Response.Write rs.Fields(0).Value & "<br>"
        rs.MoveNext
    Loop

It's a long time that I worked with Filemaker Pro, and I never accessed it via ODBC, just imported tables to SQL Server. - Remember, FM is probably not meant to be used with web applications - regarding ADO functionalities being available and scalability.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
marijaAuthor Commented:
I'm not able to get either of these to work.  For the second one, I get ADODB.Recordset error '800a0e7d'
Operation is not allowed on an object referencing a closed or invalid connection.

On the first one, it wasn't recognizing the DSN.
0
 
robbertCommented:
What is,

   Set cn = Server.CreateObject("ADODB.Connection")
   Set rs = Server.CreateObject("New ADODB.Recordset")

   cn.Open "Provider=MSDASQL.1;Data Source=FMTest;database=Sample02.fp5"
   Response.Write cn.State

Which FM version? Which code, and the error line? Any comments on the procedure MS recommended in their article? - You need to feed your consultants :-)
0
 
davemillhouseCommented:
I've been looking at connecting to Filemaker Pro databases with ASP lately.  In their literature I read that you can only have 10 seperate connections in a 12 hour period.  That's with FP 5.5 anyway.

Might be worth considering.
0
 
drittichCommented:
You can maintain one connection object with ASP and share it...
0
 
puranik_pCommented:
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
Accept robbert's comment as answer.
Please leave any comments here within the next seven days.
 
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
 
puranik_p
EE Cleanup Volunteer
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now