S
Sats
I am trying to write a function to check whether the selected value
(thru SQL query)is avalable in table or not,but every time in the
below function, CheckValue is becoming true.Can any one help me where
am I going wrong.
Private Function CheckValue() As Boolean
Dim cn As SqlCeConnection
Dim cmd As SqlCeCommand
Dim dr As SqlCeDataReader
Const strLocalConnect As String = "Data
Source=\Windows\sql.sdf"
cn = New SqlCeConnection(strLocalConnect)
cn.Open()
Dim CheckSql As String
CheckSql = "Select Assetid FROM Asset WHERE Assetid ='" &
VarValue & "'"
'MsgBox(CheckSql)
cmd = New SqlCeCommand(CheckSql, cn)
dr = cmd.ExecuteReader()
dr.Read()
If dr.IsClosed = False Then
CheckValue= True
Else
CheckValue= False
End If
cn.Close()
dr = Nothing
End Function
(thru SQL query)is avalable in table or not,but every time in the
below function, CheckValue is becoming true.Can any one help me where
am I going wrong.
Private Function CheckValue() As Boolean
Dim cn As SqlCeConnection
Dim cmd As SqlCeCommand
Dim dr As SqlCeDataReader
Const strLocalConnect As String = "Data
Source=\Windows\sql.sdf"
cn = New SqlCeConnection(strLocalConnect)
cn.Open()
Dim CheckSql As String
CheckSql = "Select Assetid FROM Asset WHERE Assetid ='" &
VarValue & "'"
'MsgBox(CheckSql)
cmd = New SqlCeCommand(CheckSql, cn)
dr = cmd.ExecuteReader()
dr.Read()
If dr.IsClosed = False Then
CheckValue= True
Else
CheckValue= False
End If
cn.Close()
dr = Nothing
End Function