Re: How to return a value from a query in code
- From: Alberto Silva <albertosilva@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 22 Mar 2006 15:52:59 +0000 (UTC)
You have to instantiate a SqlCECommand on a connection, to execute the command with a given parameter. Since your query only returns one value, the .ExecuteScalar method of the SqlCeCommand would be the more appropriate.
Alberto Silva
MS Mobile Devices MVP
http://msmvps.com/AlbertoSilva
I already had set up a query set up but I didn't know how to get the
result
in code.
Here is what I had:
SELECT SUM(Amount) AS EXPR1
FROM LineItem
WHERE (InvNum = @number)
Here is what I tried in my code to run it but I obviously don't
understand
what it needs.
This is what it asks for before I type after the (
decimal?CalcItems(int,Number)
my code:
float amt = 0;
this.lineItemTableAdapter.CalcItems(fB7MobileDBDataSet.LineItem.Invoic
eInvNumColumn, amt);
I thought I was giving it the InvoiceNum column for the @number
parameter and the amt var to hold the result. I get the error no
overload method CalcItems takes two arguments. ??
Thanks Jon Stroh hope you can straighten me out. :)
.
- Prev by Date: Notify.SetUserNotification Error
- Next by Date: Re: multiplatform (pocketPC & desktopPC) (Daniel !!)
- Previous by thread: Notify.SetUserNotification Error
- Next by thread: icon from window handle ?
- Index(es):
Relevant Pages
|