[LEFT]
[LIST=1]
[*][FONT=Courier New]Using connection [COLOR=#FF8000]As[/COLOR] [COLOR=#FF8000]New[/COLOR] SqlConnection[COLOR=#000000]([/COLOR][COLOR=#808080]"connection string here"[/COLOR][COLOR=#000000])[/COLOR][/FONT]
[*][FONT=Courier New] Using [COLOR=#0600FF]command[/COLOR] [COLOR=#FF8000]As[/COLOR] [COLOR=#FF8000]New[/COLOR] SqlCommand[COLOR=#000000]([/COLOR][COLOR=#808080]"SELECT SUM(Quantity) FROM StockItem"[/COLOR], _[/FONT]
[*][FONT=Courier New] connection[COLOR=#000000])[/COLOR][/FONT]
[*][FONT=Courier New] connection.[COLOR=#0600FF]Open[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000])[/COLOR][/FONT]
[*][FONT=Courier New] [/FONT]
[*][FONT=Courier New] [COLOR=#0600FF]Dim[/COLOR] totalQuantity [COLOR=#FF8000]As[/COLOR] [COLOR=#FF0000]Double[/COLOR] = [COLOR=#0600FF]CDbl[/COLOR][COLOR=#000000]([/COLOR][COLOR=#0600FF]command[/COLOR].[COLOR=#0000FF]ExecuteScalar[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000])[/COLOR][COLOR=#000000])[/COLOR][/FONT]
[*][FONT=Courier New] [/FONT]
[*][FONT=Courier New] [COLOR=#008080][I]'Use totalQuantity here.[/I][/COLOR][/FONT]
[*][FONT=Courier New] [COLOR=#0600FF]End[/COLOR] Using[/FONT]
[*][FONT=Courier New][COLOR=#0600FF]End[/COLOR] Using [/FONT]
[/LIST]
[/LEFT]