cancel
Showing results for 
Search instead for 
Did you mean: 

.net providers and System.Data.Entity

0 Kudos
555

The 4.5 .net provider works up to .net 4.8 without any problems.

I just put together an application using .net 8 - the 4.5 .net provider still manages most calls to the DB except when it comes to byte - for instance...

Public Function InsertEmailAttachment(Attachment() As Byte, Inbox_ID As Integer, FileName As String) As Boolean
Try
    Dim strSQL As String = ""
    Using Conn As New SAConnection
        Conn.ConnectionString = HASConString
        Dim vCmd As SACommand = Conn.CreateCommand
        vCmd.Parameters.AddWithValue("@Mail_Inbox_ID", Inbox_ID)
        vCmd.Parameters.AddWithValue("@Attachment_FileName", FileName)
        vCmd.Parameters.AddWithValue("@Attachment", Attachment)
        strSQL = "INSERT INTO Mail_Inbox_Attachments (Mail_Inbox_ID, Attachment_FileName, Attachment) VALUES (?, ?, ?)"
        vCmd.CommandText = strSQL
        Conn.Open()
        vCmd.ExecuteNonQuery()
        Conn.Close()
    End Using
    Return True
Catch ex As Exception
    EmailError(ex)
    Return False
End Try
End Function

That throws - Could not load file or assembly 'System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. The system cannot find the file specified.

If I refence that dll in the project I get - System.BadImageFormatException: Cannot load a reference assembly for execution.

Is there a later version of the Sybase provider that is not reliant on System.Data.Entity, or some other workaround other than OLE.DB?

Accepted Solutions (1)

Accepted Solutions (1)

Problem solved - I referenced a 32 bit version of System.Data.Entity and there was a 'bitness' mismatch - it now works 🙂

Answers (0)