Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

help connecting visual basic with sql server

Hello

i need to connect a visual basic 2010 express application with the sql server database which runs our business one application, any ideas how i do this?

thanks

dave

Tags:
Former Member
replied

Hi Dave,

you can use the most generic connection object ODBC.

This is an example from MS to connect to a dataset by code

' Visual Basic

    Public Sub ConnectToOdbc()

        Dim conn As New System.Data.Odbc.OdbcConnection

        ' TODO: Modify the connection string and include any

        ' additional required properties for your database.

        conn.ConnectionString = & _

            "FIL=MS Access;DSN=valid data source name"

        Try

            conn.Open()

            ' Insert code to process data.

        Catch ex As Exception

            MessageBox.Show("Failed to connect to data source")

        Finally

            conn.Close()

        End Try

    End Sub

But you'll typically NEVER EVER connect to productive SAP system's database directly. No one would allow that.

There are "official" ways to gather data out of the SAP systems like SAP NetWeaver Gateway as an generic approach.

Best regards,

Matthias

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question