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

Monday, July 12, 2004

Public Function execute_qry :

Public Function execute_qry :

This method is used to execute the ‘sql’ query.
It accepts one argument namely str_qry.
Cmd is the object of the sqlcommand class
Con is the object of the sqlconnection class
Executescalar method of command object executes the given query and returns the first column value of the first row.


Public Function execute_qry(ByVal str_qry As String)
result = 0
Try
cmd = New SqlCommand(str_qry, con)
con.Open()
result = cmd.ExecuteScalar
Catch ex As Exception
MsgBox(ex.ToString)
Finally
con.Close()
End Try
End Function