2017-09-08 5 views
-4

Bitte habe ich die folgenden vb.net 2010 und MySQL und ich verwendet den getrennten Modus.Lager Wert in vb.net Variable

Ich möchte

dim value1 as int = (select count(*) from table) 

tun Wie kann ich einen Datensatz und excute die SQL-Abfrage in getrennten Modus erstellen?

Thnanks im Voraus

+0

kann mir bitte helfen –

Antwort

0
dim value1 as int 

using connection as SqlConnection = new SqlConnection(YOURCONNECTIONSTRING) 
connection.open 
using command as SqlCommand = new SqlCommand("select count(*) AS QTY from table", connection) 
using reader as SqlReader = command.ExecuteReader() 
value1 = reader.getInt32(reader.GetOrdinal("QTY")) 
End Using 
end Using 
End Using