' Add a parameter in the SQL with a proper syntax depending on the backend ' expC1 Field Public Function ParameterAddSQL(ByVal tcField As String) As String Dim lcString As String = "" ' Different backends handle it differently Select Case nBackend ' Visual FoxPro Case 1 lcString = "?" ' SQL Server Case 2 lcString = "@" + tcField ' SQL Anywhere Case 4 lcString = "?" End Select Return lcString End FunctionAn example would be:
loDataProvider.ParameterAdd("Numero", oProcess.nNoMember, , "Member", "Numero") If Not loDataProvider.SQLExec("SELECT Member.NoType " + _ "FROM Member " + _ "WHERE Member.Numero=" + loDataProvider.ParameterAddSQL("Numero") ) Then Return False End IfI am still not sure however if I could change ParameterAddSQL() to adjust the string based on the type of connection instead such as:
' Add a parameter in the SQL with a proper syntax depending on the backend ' expC1 Field Public Function ParameterAddSQL(ByVal tcField As String) As String Dim lcString As String = "" ' Different SQL mode handle it differently Select Case nSQLMode ' OleDb Case 1 lcString = "?" ' SQL client Case 2 lcString = "@" + tcField ' ODBC Case 3 lcString = "?" End Select Return lcString End Function