/ Published in: VB.NET
This is a method that can be used to take a connection string and a valid oledb command and perform a scalar. This returns an Integer/Int32 value.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
Private conn As OleDbConnection = New OleDbConnection() 'Private conn As New OleDbConnection Public Function doScalar(ByVal connString As String, ByVal command As OleDb.OleDbCommand) As Int32 Dim value As Int32 = 0 Try conn.ConnectionString = connString command.Connection = conn conn.Open() value = command.ExecuteScalar() Catch ex As Exception Return Nothing Finally command.Dispose() End Try Return value End Function