2006-11-08
Asp.Net2.0 ExecuteScalar
Dim cn As New SqlConnection("Server=localhost;Database=Northwind;UID=sa;PWD=P@ssw0rd;")
Dim cmd As New SqlCommand("select count(orderid) from orders", cn)
cn.Open()
Dim count As Integer = cmd.ExecuteScalar
cn.Close()
Response.Write(count)
Dim cmd As New SqlCommand("select count(orderid) from orders", cn)
cn.Open()
Dim count As Integer = cmd.ExecuteScalar
cn.Close()
Response.Write(count)