I'm developing an application in Visual Studio 2013 using Visual Basic with an SQL Server database. When I perform a query it gives me the following error message Dynamic SQL generation is not supported against multiple databases
If I execute the query in the SQL Management Studio executes perfect but in the application throws the error.The curious thing is that after throwing the error the query executes perfectly. Please help me. Here is the code:
If I execute the query in the SQL Management Studio executes perfect but in the application throws the error.The curious thing is that after throwing the error the query executes perfectly. Please help me. Here is the code:
Code:
If rdbCustCelPnone.Checked = True Then
Try
SQL.RunQuery("SELECT * FROM SERVICE_ORDER, CUSTOMER WHERE SERVICE_ORDER.custID = CUSTOMER.custID AND CUSTOMER.custCelPhone = '" & txtSearchSO.Text & "' ")
If SQL.SQLDS.Tables(0).Rows.Count <> 0 Then
dgvDisplaySO.DataSource = SQL.SQLDS.Tables(0)
SQL.SQLDA.UpdateCommand = New SqlClient.SqlCommandBuilder(SQL.SQLDA).GetUpdateCommand
Else
MsgBox("No record found with that search criteria. Please perform another search ! ! !")
'refreshClear()
Exit Sub
End If
Catch ex As Exception
'MsgBox(ex.Message) '<-----Research Exception ( Dynamic SQL generation is not supported against multiple databases )
End Try