AnsweredAssumed Answered

BLOB!

Question asked by leonaisse on Jun 20, 2013
Latest reply on Jun 20, 2013 by MikhailEdoshin

Title

BLOB!

Post

     Hi All

     I have set up a Filemaker ODBC connection on my webserver as i would like to populate a FileMaker Container field from an asp.net application. Does anyone have any code samples as i am having initial issues.

      

     The ODBC connection works

     I have converted my file to a binary stream

     This is my code asp.net code.

'' create stream

Dim fs As New FileStream(ConfigurationManager.AppSettings("uploadedDocs") & strSaveFileName, FileMode.OpenOrCreate, FileAccess.Read)

Dim MyData(fs.Length) As Byte

fs.Read(MyData, 0, fs.Length)

fs.Close()

fs = Nothing

  

'' Add into filemaker

Dim cn_FMP As New Odbc.OdbcConnection(WebConfigurationManager.ConnectionStrings("cn_FMP").ConnectionString)

Dim sqlCommand1 As New Odbc.OdbcCommand("INSERT INTO FMPDocStore (filename, caseID, FileType, dateTimeStamp, fileDoc, useInReport) VALUES @filename, @caseID, @FileType, @datetimenow, @fileDoc, @useinreport", cn_FMP)

sqlCommand1.Parameters.AddWithValue("@filename", "test test")

sqlCommand1.Parameters.AddWithValue("@caseID", Request.QueryString("caseID"))

sqlCommand1.Parameters.AddWithValue("@FileType", "Test Test")

sqlCommand1.Parameters.AddWithValue("@dateTimeStamp", DateTime.Now)

sqlCommand1.Parameters.AddWithValue("@fileDoc", MyData)

sqlCommand1.Parameters.AddWithValue("@useInReport", True)

sqlCommand1.CommandTimeout = "120"

sqlCommand1.CommandType = CommandType.Text

cn_FMP.Open()

sqlCommand1.ExecuteReader()

This is the current error:

     System.Data.Odbc.OdbcException (0x80131937): ERROR [42000] [FileMaker][FileMaker] FQL0001/(1:98): There is an error in the syntax of the query

     Does everything have to be passed in binary?

     Does anyone know of any asp.net to FMP sample code vb or c#?

     Thanks

     Leonaisse

      

Outcomes