[thelist] Classic to Asp.NET 2.0
Rob Smith
rob.smith at lexjet.com
Wed Jun 14 15:00:40 CDT 2006
Got Reflector... Thanks
Sub Page_Load(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
'Start by determining the connection string value
Dim connString As String = _
ConfigurationManager.ConnectionStrings("Server09").ConnectionString
'Create a SqlConnection instance
Using myConnection As New SqlConnection(connString)
'Specify the SQL query
Dim sql As String = "SELECT count(adID) as totals FROM
lexjet_marketing_new Where publish <= '" & Date.Now() & "' and expire >
'" & Date.Now() & "' and preview = 0 order by newid()"
'Create a SqlCommand instance
Dim myCommand As New SqlCommand(sql, myConnection)
Try
myConnection.Open()
MsgBox(myCommand.ExecuteScalar())
Catch ex As Exception
Console.WriteLine(ex.Message)
End Try
'Close the connection
myConnection.Close()
End Using
End If
End Sub
Works. Thanks!
Rob Smith
LexJet
rob.smith at lexjet.com
http://www.lexjet.com
(800)453-9538
(941)330-1210 Int'l
(941)330-1220 Fax
1680 Fruitville Road, 3rd Floor
Sarasota, FL 34236
More information about the thelist
mailing list