Thread: Bind a Label
View Single Post
Old January 3rd, 2007, 04:32 PM
cp75 cp75 is offline
Authorized User
Join Date: Aug 2006
Location: , , USA.
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts

Public Function GetSalesman()

Dim myConn AS OleDbConnection
Dim myCommand As OleDbCommand
Dim myReader As OleDbDataReader
Dim query As String
'specify the data source
myConn = new OleDbConnection ("Provider=Microsoft.Jet.OLEDB.4.0;data source=" & server.mappath("/db/uoi.mdb"))
'define the command query
query = "SELECT Distinct Nro FROM Clients,Salesman WHERE Salesman.Username='" & Context.User.Identity.Name &"'"

'create a command object and set its
myCommand = new OleDbCommand ( query, myConn )

'open the connection and instantiate a datareader
myConn.Open ( )
myReader = myCommand.ExecuteReader ( )

return myReader
'close the reader and the connection
myReader.Close ( )
myConn.Close ( )

End Function