I'm building an ASP.NET intranet application. I have a table that stores a range of Bill of Lading numbers each day (say 1-10). I want to pull in the range of BOLs based on the max(date) and assign them to a variable. That way, the BOLs in the dataset become the beginning numbers for the new day, and the user just has to input the ending BOLs for that day. Question is, how can I assign the DataSet to a variable (array) that, in turn, can be re-used in an INSERT statement? I know this is a combo SQL/ASP.NET question, but I'm really concerned with the variable assignment, not the INSERT statement.
Here's my code, note the use of the Datagrid was for my visual purposes.
<script language = "
VB" runat="server">
sub Page_Load(sender as Object, e as EventArgs)
dim cnn as sqlconnection = new sqlconnection("server=blah;")
try
cnn.open()
dim comm as sqlDataAdapter = New SqlDataAdapter ("SELECT [225_ENDING_BOL],[235_ENDING_BOL],[260_ENDING_BOL],[302_ENDING_BOL],[306_ENDING_BOL],[310_ENDING_BOL],[314_ENDING_BOL], [318_ENDING_BOL], [322_ENDING_BOL], [326_ENDING_BOL], [334_ENDING_BOL] FROM KM_BOL_RANGE WHERE lifted_date=(select max(lifted_date) from dbo.km_bol_range)", cnn)
dim DS as new DataSet
comm.fill(DS,"BOL")
DataGrid1.DataSource=DS.Tables("BOL").DefaultView
DataGrid1.Databind()
catch ex as SqlException
Status.Text = ex.Message
Finally
cnn.close()
end try
End Sub
</script>