Internet is growing Every Seconds :: Industry is growing Every Year

Tuesday, July 06, 2004

Public Overloads Function IsRecordExist

Public Overloads Function IsRecordExist :

This method is used to find the specified Record Exists in the table.
This accepts 4 arguments namely, TableName, FieldName, FieldValue and Datatype.
TableName – Name of the table
FieldName – Name of the Field
Fieldvalue – value of the field
Datatype – Datatype of the Fieldname.



Public Overloads Function IsRecordExist(ByVal TableName As String, ByVal fieldname As String, ByVal fieldvalue As String, ByVal datatype As String) As Boolean
'str_qry = "select " & fieldname & " from " & TableName & " where "
str_qry = "select count(*) from " & TableName & " where "
If UCase(datatype) = "C" Then
fieldvalue = "'" & fieldvalue & "'"
End If
str_qry = str_qry & fieldname & " =" & fieldvalue & ""
'MsgBox(str_qry)
execute_qry(str_qry)
If result > 0 Then
Return True
Else
Return False
End If
End Function


//////////////////////////////////////////////////////////////////////////////////////////////////

Public Overloads Function IsRecordExist(ByVal TableName As String, ByVal fieldname1 As String, ByVal fieldvalue1 As String, ByVal datatype1 As String, ByVal fieldname2 As String, ByVal fieldvalue2 As String, ByVal datatype2 As String) As Boolean
If UCase(datatype1) = "C" Then
fieldvalue1 = "'" & fieldvalue1 & "'"
End If
If UCase(datatype2) = "C" Then
fieldvalue2 = "'" & fieldvalue2 & "'"
End If
str_qry = "select count(*) from " & TableName & " where "
str_qry = str_qry & fieldname1 & " =" & fieldvalue1 & " and "
str_qry = str_qry & fieldname2 & " =" & fieldvalue2 & ""

execute_qry(str_qry)
If result > 0 Then
Return True
Else
Return False
End If
End Function

//////////////////////////////////////////////////////////////////////////////////////////////////
Public Overloads Function IsRecordExist(ByVal TableName As String, ByVal fieldname1 As String, ByVal fieldvalue1 As String, ByVal datatype1 As String, ByVal fieldname2 As String, ByVal fieldvalue2 As String, ByVal datatype2 As String, ByVal fieldname3 As String, ByVal fieldvalue3 As String, ByVal datatype3 As String) As Boolean
If UCase(datatype1) = "C" Then fieldvalue1 = "'" & fieldvalue1 & "'"
If UCase(datatype2) = "C" Then fieldvalue2 = "'" & fieldvalue2 & "'"
If UCase(datatype3) = "C" Then fieldvalue3 = "'" & fieldvalue3 & "'"

str_qry = "select count(*) from " & TableName & " where "
str_qry = str_qry & fieldname1 & " =" & fieldvalue1 & " and "
str_qry = str_qry & fieldname2 & " =" & fieldvalue2 & " and "
str_qry = str_qry & fieldname3 & " =" & fieldvalue3
'MsgBox(str_qry)
execute_qry(str_qry)
If result > 0 Then
Return True
Else
Return False
End If
End Function
//////////////////////////////////////////////////////////////////////////////////////////////////