-1

I have a query that counts rows, so it only returns an integer.

Dim strQuery As String = "SELECT COUNT(*) FROM table WHERE ..."

How can I store this integer into a variable so I can use it later?

winter
  • 207
  • 1
  • 4
  • 13
  • 1
    Does this answer your question? [Select from mysql put into variable VB.NET](https://stackoverflow.com/questions/16027925/select-from-mysql-put-into-variable-vb-net) – Syed M. Sannan May 23 '20 at 10:44

1 Answers1

0

You use NuGet package mnaager to install Dapper, then you do:

Dim con = "YOUR CONNECTION STRING HERE!"
Dim sql = "SELECT COUNT(*) FROM person WHERE lastname = @LN"
DIm count = New MySqlConnection(con).QuerySingle(sql, New With{.LN = "Smith"})

https://dapper-tutorial.net

Caius Jard
  • 72,509
  • 5
  • 49
  • 80