Sreekanth_Nagabandi
asked on
Missing operand before 'And' operator
Hi,
I have the following method , I am using a active filter to return the fields which are active . I am getting the following error. I wonder if you can fix the error. I will post the method , please look in to that.
Error Message : Syntax error: Missing operand before 'And' operator.
I am getting the above error at the following line in the below method.
AlarmModification.RowFilte r = FilterStr.
Function GetAlarmSet() As DataView
Dim AlarmConn As SqlConnection
Dim AlarmAdapter As SqlDataAdapter
Dim AlarmSet As New DataSet()
Dim QueryString As String
'Dim AlarmView As DataView
Dim FilterStr As String = String.Empty
QueryString = "select a.alarm_ID , a.Description, a.mode,a.active, a.regulatory_alarm, a.auto_acknowledge," & _
" b.UNIT_ID as unitid" & _
" from Alarm_Definition a, Unit b where a.unit_Id=b.UNIT_ID "
AlarmConn = New SqlConnection(Configuratio nManager.C onnectionS trings("CM SConnStr") .Connectio nString)
Try
'Load Alarm record Table
AlarmAdapter = New SqlDataAdapter(QueryString , AlarmConn)
AlarmAdapter.Fill(AlarmSet , "AlarmDefinition")
Catch ex As Exception
Dim errorMsg As String = ex.Message & " :Exception Inside AlarmModification.GetAlarm Set()"
'Check if an exception occured while logging to the database
'Initially store the errorMsg in the CLogger property
CLogger.LogDB = "N"
CLogger.CustomErrorMsg = errorMsg
If CLogger.WriteLogMsg(errorM sg, "E") Then
CLogger.LogDB = "Y"
End If
Throw New Exception(errorMsg)
Finally
If AlarmConn.State = ConnectionState.Open Then
AlarmConn.Close()
End If
End Try
'Get the Filter String
FilterStr = FormFilterStr()
AlarmModification = New DataView(AlarmSet.Tables(" AlarmDefin ition"))
AlarmModification.RowFilte r = FilterStr
'AlarmModification.Sort = ViewState("sortField") & " " & ViewState("sortDirection")
Return AlarmModification
End Function
Thanks,
Sreekanth Nagabandi.
I have the following method , I am using a active filter to return the fields which are active . I am getting the following error. I wonder if you can fix the error. I will post the method , please look in to that.
Error Message : Syntax error: Missing operand before 'And' operator.
I am getting the above error at the following line in the below method.
AlarmModification.RowFilte
Function GetAlarmSet() As DataView
Dim AlarmConn As SqlConnection
Dim AlarmAdapter As SqlDataAdapter
Dim AlarmSet As New DataSet()
Dim QueryString As String
'Dim AlarmView As DataView
Dim FilterStr As String = String.Empty
QueryString = "select a.alarm_ID , a.Description, a.mode,a.active, a.regulatory_alarm, a.auto_acknowledge," & _
" b.UNIT_ID as unitid" & _
" from Alarm_Definition a, Unit b where a.unit_Id=b.UNIT_ID "
AlarmConn = New SqlConnection(Configuratio
Try
'Load Alarm record Table
AlarmAdapter = New SqlDataAdapter(QueryString
AlarmAdapter.Fill(AlarmSet
Catch ex As Exception
Dim errorMsg As String = ex.Message & " :Exception Inside AlarmModification.GetAlarm
'Check if an exception occured while logging to the database
'Initially store the errorMsg in the CLogger property
CLogger.LogDB = "N"
CLogger.CustomErrorMsg = errorMsg
If CLogger.WriteLogMsg(errorM
CLogger.LogDB = "Y"
End If
Throw New Exception(errorMsg)
Finally
If AlarmConn.State = ConnectionState.Open Then
AlarmConn.Close()
End If
End Try
'Get the Filter String
FilterStr = FormFilterStr()
AlarmModification = New DataView(AlarmSet.Tables("
AlarmModification.RowFilte
'AlarmModification.Sort = ViewState("sortField") & " " & ViewState("sortDirection")
Return AlarmModification
End Function
Thanks,
Sreekanth Nagabandi.
can you show us what the function FormFilterStr() returns?
ASKER
Hi,
The form filterString returns the following values.
Return Value captured during debugging:- and unitid in (1,2,3,4,5,6,7,8)
I will post you the method.
''' <summary>
''' Method to form filter string based on the selected tree node and dropdown filters
''' </summary>
''' <returns>Filter String</returns>
''' <remarks></remarks>
Protected Function FormFilterStr() As String
Dim FilterStr As String
Dim strFilter As String = String.Empty
If Not MACTTree Is Nothing Then
If Not MACTTree.SelectedNode Is Nothing Then
strFilter = SelectTreeNode(MACTTree)
End If
End If
If StrComp(ActiveFilter.Selec tedValue, " ", CompareMethod.Text) = 0 Then
'FilterStr = ACKFilter.SelectedValue
'ElseIf StrComp(ACKFilter.Selected Value, " ", CompareMethod.Text) = 0 Then
FilterStr = ActiveFilter.SelectedValue
Else
'FilterStr = ActiveFilter.SelectedValue & " and " & ACKFilter.SelectedValue
End If
Session("SelectedActiveFil ter") = ActiveFilter.SelectedIndex
'Session("SelectedACKFilte r") = ACKFilter.SelectedIndex
'Adding TreeNode Filter to the Active and Acknowledge filters list
If strFilter Is String.Empty Then
Else
If StrComp(FilterStr, " ", CompareMethod.Text) = 0 Then
FilterStr = strFilter
Else
FilterStr += "and " & strFilter
End If
End If
Session("FilterStr") = FilterStr
Return FilterStr
End Function
Thanks,
Sreekanth
The form filterString returns the following values.
Return Value captured during debugging:- and unitid in (1,2,3,4,5,6,7,8)
I will post you the method.
''' <summary>
''' Method to form filter string based on the selected tree node and dropdown filters
''' </summary>
''' <returns>Filter String</returns>
''' <remarks></remarks>
Protected Function FormFilterStr() As String
Dim FilterStr As String
Dim strFilter As String = String.Empty
If Not MACTTree Is Nothing Then
If Not MACTTree.SelectedNode Is Nothing Then
strFilter = SelectTreeNode(MACTTree)
End If
End If
If StrComp(ActiveFilter.Selec
'FilterStr = ACKFilter.SelectedValue
'ElseIf StrComp(ACKFilter.Selected
FilterStr = ActiveFilter.SelectedValue
Else
'FilterStr = ActiveFilter.SelectedValue
End If
Session("SelectedActiveFil
'Session("SelectedACKFilte
'Adding TreeNode Filter to the Active and Acknowledge filters list
If strFilter Is String.Empty Then
Else
If StrComp(FilterStr, " ", CompareMethod.Text) = 0 Then
FilterStr = strFilter
Else
FilterStr += "and " & strFilter
End If
End If
Session("FilterStr") = FilterStr
Return FilterStr
End Function
Thanks,
Sreekanth
ASKER
Hi,
I appreciate your help. I have resolved the problem .
Thanks,
Sreekanth
I appreciate your help. I have resolved the problem .
Thanks,
Sreekanth
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.