U can use 2 approach. You can write a stored procedure in the database and then call it from VB or you can include the SQL command in the VB code and query the database. I dont recommend the latter since it is slower and harder to maintain. So you can:
Call a Stored Procedure
Code:
dim cmd as new SQLCommand()
with cmd
.commandtype = CommandType.StoredProcedure
.commandtext = "yourstoredproceduresname"
.CommandTimeout = 0
.Connection.ConnectionString = "The connection string for the database here"
end with
dim da as new sqldatadapter(cmd)
dim ds as new dataset
da.Fill(ds)
''' Bind Column1 from table to a drop down list
ddl.datasource = ds.Tables(0)
ddl.datatextfield = "Column1"
ddl.databind()