Skip to main content

Posts

Showing posts with the label return nothing

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