Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 363
  • Last Modified:

sql return a query result to a variable

It´s possible return a query result to a variable instead a datareader. For ex. in some cases i need return only a sum or two.
0
rflorencio
Asked:
rflorencio
1 Solution
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
for a single value: yes:
ExecuteScalar() returns an object with the single value.

as soon as you need more values/rows, either use a stored procedure with adequate output parameters, or do use the datareader (or dataset/datatable)
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now