Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need SQL string or SP

Status
Not open for further replies.

tsp1lrk72

IS-IT--Management
Feb 25, 2008
100
US
Hello- The following code gives me the data I need, but now I need to get it into my VB.net code- can I call this as a SQL string right in the sub?

Code:
SELECT SUM(Quantity),
CASE Product
    WHEN 'FIR-UPPERS' THEN 'MBF' 
	WHEN 'Nantucket Beadboard' THEN 'Truckload'
	WHEN 'Plywood Treads and Risers' THEN 'Pallet'
	WHEN 'Poplar and Oak Boards' THEN 'UNITS' 
	WHEN 'EWC Shingles' THEN 'SQUARES' 
	WHEN 'Unfinished Oak Flooring' THEN 'SQ FT' 
	WHEN 'WRC Shingles' THEN 'CARTONS' 
  END
FROM tblPoolinfo
Group by Product

Or should it be a Stored Procedure and then called from the code, not sure of the best approach.

Thanks-
 
The results will probably go into a datagrid...if possible
 
Have you worked with ADO.Net before? I'm not sure if your question is a data access question or just a string building question. But, to build that string into your app, it is as simple as:

Code:
YourCommand.CommandText = "SELECT SUM(Quantity)," & controlchars.crlf
YourCommand.CommandText &= "CASE Product" & ControlChars.CrLf
'etc, etc
 
Thanks I'll give it a shot... More of a string building question- I appreciate your assistance-
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top