Skip to main content

Posts

Showing posts with the label msgbox

Function to check key validation using asp.net

Function to check key validation using asp. net ublic Function KeyValid(ByVal keyChar As Char, ByVal strType As KeyType) As Boolean Dim blnRetVal As Boolean Dim strNumStr As String = "0123456789" Dim strDecStr As String = "0123456789." Dim strAlpha As String = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" Dim strDate As String = "0123456789/" Dim strPhone As String = "0123456789-()," Dim strTime As String = "01234567890:" Dim strEqn As String = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789./*+-()|" Dim strAlphaNum As String = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" Try blnRetVal = False If Asc(keyChar) < 32 Then KeyValid = False Exit Function End If Select Case strType Case KeyType.KeyAlpha If strAlpha.IndexOf(keyChar) < 0 Then blnRetVal = Not blnRetVal Case KeyType.KeyAlphaNum If strAlphaNum.IndexOf(keyChar) &

function to Get scalar value and Get value of table using query using asp.net code

function to Get scalar value using asp.net code Public Function getSclarValue(ByVal Qry As String) As String Dim cmdDatabase As New SqlCommand Try cmdDatabase = New SqlCommand(Qry, objCn.openDb()) Return cmdDatabase.ExecuteScalar() Catch ex As Exception MsgBox(ex.Message) Return Nothing Finally objCn.closeDb() End Try End Function Function to Get value of table using query in asp.net Public Function GetTable(ByVal str As String) As DataTable Try Dim dt As New DataTable Dim cmd As New SqlCommand(str, objCn.openDb()) Dim adp As New SqlDataAdapter(cmd) adp.Fill(dt) Return dt Catch ex As Exception MsgBox("Error" + ex.Message) Return Nothing Finally objCn.closeDb() End Try End Function