Option Strict On prohibits operands of type Object for operator '&'.

  • Thread starter Thread starter ricostrydom
  • Start date Start date
R

ricostrydom

Guest
Hello,

I have a dynamic sql query that looks like this:

Variable_UTool.MySqlQuery = IIf(TabControl_XML.SelectedTab.Text = "TEST SET OVERVIEW",
"SELECT DISTINCT U.UId, U.Username " &
"FROM USERS U " &
"LEFT JOIN XML_TEST_SET_OVERVIEW TSO " &
"ON TSO.UId = U.UId WHERE " &
IIf(Me.ToolStripComboBox_Environment.ComboBox.SelectedValue Is Nothing,
"TSO.ENVId IS NOT NULL AND ",
"TSO.ENVId = " & Me.ToolStripComboBox_Environment.ComboBox.SelectedValue & " AND ") &
IIf(Me.ToolStripComboBox_MessageType.ComboBox.SelectedValue Is Nothing,
"TSO.MTId IS NOT NULL AND ",
"TSO.MTId = " & Me.ToolStripComboBox_MessageType.ComboBox.SelectedValue & " AND ") &
IIf(Me.ToolStripComboBox_TestSetName.ComboBox.SelectedValue Is Nothing,
"TSO.TestSetName IS NOT NULL AND ",
"TSO.TestSetName = '" & Me.ToolStripComboBox_TestSetName.ComboBox.SelectedValue & "' AND ") &
IIf(Me.ToolStripComboBox_TestCaseName.ComboBox.SelectedValue Is Nothing,
"TSO.TestCaseName IS NOT NULL AND ",
"TSO.TestCaseName = '" & Me.ToolStripComboBox_TestCaseName.ComboBox.SelectedValue & "' AND ") &
IIf(Me.ToolStripComboBox_InterchangeSeqNo.ComboBox.SelectedValue Is Nothing,
"TSO.InterchangeSeqNo IS NOT NULL AND ",
"TSO.InterchangeSeqNo = " & Me.ToolStripComboBox_InterchangeSeqNo.ComboBox.SelectedValue & " AND ") &
IIf(Me.ToolStripComboBox_InstructionSeqNo.ComboBox.SelectedValue Is Nothing,
"TSO.InstructionSeqNo IS NOT NULL AND ",
"TSO.InstructionSeqNo = " & Me.ToolStripComboBox_InstructionSeqNo.ComboBox.SelectedValue & " AND ") &
IIf(Me.ToolStripComboBox_TransactionSeqNo.ComboBox.SelectedValue Is Nothing,
"TSO.TransactionSeqNo IS NOT NULL ",
"TSO.TransactionSeqNo = " & Me.ToolStripComboBox_TransactionSeqNo.ComboBox.SelectedValue & " "),
"")


Unfortunately (due to Option Strict) I am getting errors with all the...

Me.ToolStripComboBox_*.ComboBox.SelectedValue

Option Strict On prohibits operands of type Object for operator '&'.

I have tried the following but it does not help.

CInt(Me.ToolStripComboBox_*.ComboBox.SelectedValue)

(* = Specific ComboBox)


Please help.

Continue reading...
 
Back
Top