CType(Me.Master, MasterPages_MasterPageName).FunctionOrSubName()
Simple as that!
The "Ten Commandments", if you will, of .NET development. Definitely not limited to ten, nor groundbreaking by any means, this blog emphasizes simple code that any .NET developer should know; without the fluff and bloated code examples. "Just show me how to..."
CType(Me.Master, MasterPages_MasterPageName).FunctionOrSubName()
ssql="SELECT TOP 10 * FROM [someTable] ORDER BY NEWID()"
Dim objDR As SqlClient.SqlDataReader
Dim objCommand As SqlClient.SqlCommand
Dim ConnectionString As String = "YOUR CONNECTION STRING HERE"
Dim objConnection As SqlClient.SqlConnection
Dim ssql As String
objConnection = New SqlClient.SqlConnection(ConnectionString)
ssql = "SELECT * FROM someTable"
If objConnection.State <> ConnectionState.Open Then
objConnection.Open()
End If
objCommand = New SqlClient.SqlCommand(ssql, objConnection)
objDR = objCommand.ExecuteReader(CommandBehavior.CloseConnection)
objCommand = Nothing
If objDR.HasRows Then
While objDR.Read()
' do your code here
' the following gives access
' to the table's field:
' objDR.Item("someField")
End While
End If
objDR.Close()
objDR = Nothing