Skip to Content
avatar image
Former Member

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Jan 22, 2013 at 01:58 PM

    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

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      thanks

      this is something i am working on against a developement database to "prove" it could be done, but clearly wouldn't do this to a production system

      cheers

      dave