Skip to content

Instantly share code, notes, and snippets.

@cloudflying
Created August 28, 2012 23:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cloudflying/3505358 to your computer and use it in GitHub Desktop.
Save cloudflying/3505358 to your computer and use it in GitHub Desktop.
grab a single value from sql
Using conn As New SqlConnection(connectionString)
Using cmd As New SqlCommand
With cmd
.Connection = conn
.CommandText = "SELECT value FROM table;"
.Connection.Open()
Dim var as string = .ExecuteScalar()
.Connection.Close()
End With
End Using
End Using
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment