Returning Stored procedure from SQL via ODBC

Hello,

I have a very big application here that connects to a mySQL database. For each stored procedure in the server, there is a function or sub in the application. The problem is that I needed to migrate this database to a SQL Server, so all the routines that were made for mySQL need to be adapted...

The app has a function to "ExecuteReader" and a "ExecuteCommand" to read tables and send commands with no return.

The ExecuteReader function is like this:

Function ExecuteReader(ByVal SQLString As String, Optional ByVal Parameters As List(Of OdbcParameter) = Nothing) As DataTable SyncLock GlobalCommandBridge 'Function that executes a command bringing back results, usually used for selects. It returns all results as a Datatable. Dim Result As DataTable = New DataTable 'bridgeCommand = New OdbcCommand("USE " & Database & ";", bridgeConnection) Try bridgeCommand.Parameters.Clear() 'If Not ConnectionState = Data.ConnectionState.Open Then OpenConnection() 'bridgeCommand.ExecuteNonQuery() 'Set Parameters if there are any If Not Parameters Is Nothing Then For Each Parameter As OdbcParameter In Parameters bridgeCommand.Parameters.Add(Parameter) Next End If If bridgeConnection.State = ConnectionState.Open Then 'Executes the command and gather the result back to the Result Datatable object. bridgeCommand.CommandText = Replace(SQLString, "\", "\\") 'Application.DoEvents() Result.Load(bridgeCommand.ExecuteReader) Return Result Else 'If the connection couldn't be opened, returns nothing. Return Nothing End If Catch ex As Exception MsgBox(ex.Message) Return Nothing End Try End SyncLock End Function

Since there are tons of functions like this, I rather adapt the "ExecuteReader" function to work without changing them... One thing I noticed is that parameters in SQL Server have an "@" in front of them... I was trying to make it work but got the error: