|
You don't know what stored procedures are?
only two letters away from being an asset
|
|
|
|
|
|
Then go away and don't come back until you do.
only two letters away from being an asset
|
|
|
|
|
That depends on the query. It's not really that the query is too long, but probably that the DataAdapter will only work with queries that return data from a single table with a primary key.
|
|
|
|
|
michaelgr1 wrote: dataAdapter =
new SqlDataAdapter(selectcommand3, connectionstring);
Did you put one too many new lines after that = statement? at most the assignment should be the next line down, you shouldn't add any space between the 2 lines.
|
|
|
|
|
I am BATMAN wrote: at most the assignment should be the next line down
Not according to the language spec. You can have as many white space chars as you like including multiple newlines. I've just checked with a prog by adding multiple newlines - compiles without error.
Regards
David R
---------------------------------------------------------------
"Every program eventually becomes rococo, and then rubble." - Alan Perlis
|
|
|
|
|
if what you say in currect you can use @"" string style:
SqlCommand mySqlComm = new SqlCommand();
mySqlComm.CommandText = @"
type your string here
";
but I think your sql statement is incorrect. Copy your SqlCommandText and paste in in sql Query analyzer and test it. if it has not that error what you said it correct.
|
|
|
|
|
Hi!
My work mate have asked me to program a software which he could see when he started his computer and when he shuts the computer down.
He would like a to save this information in a text file.
I have no problem creating a Console Application to run when Windows was started using Windows auto start folder in the Start/Program-meny.
But the opposite, when Windows is closing down, I have no clue how to do.
Any ideas? I would prefer to have both functions in the same program, if that could be arranged easily.
/Mc_Topaz
|
|
|
|
|
create a service that writes a message when starting and stopping. The only probelm with this is if someone manually stops the service
|
|
|
|
|
Do do I create a service?
|
|
|
|
|
Easy - www.google.com and search for "windows services + c#" should give you enough references.
Excellence is doing ordinary things extraordinarily well.
|
|
|
|
|
Hi,
Windows will run a script at startup, shutdown, login and logoff so all you require is a very simple command file.
e.g.
@echo %DATE% %TIME% %1 >> v:\syslog.txt
to generate the output
04/05/2009 14:53:03.25 SHUTDOWN
04/05/2009 14:54:33.25 STARTUP
04/05/2009 14:55:11.79 LOGON
The group policy editor gpedit.msc allows assignment of a script and the parameter (%1) which in this example are the strings SHUTDOWN, STARTUP and LOGON.
Alan.
|
|
|
|
|
Hi!
My work mate have asked me to program a software which he could see when he started his computer and when he shuts the computer down.
He would like a to save this information in a text file.
I have no problem creating a Console Application to run when Windows was started using Windows auto start folder in the Start/Program-meny.
But the opposite, when Windows is closing down, I have no clue how to do.
Any ideas? I would prefer to have both functions in the same program, if that could be arranged easily.
/Mc_Topaz
|
|
|
|
|
Sorry for this double post
Bah... I can't spell today
|
|
|
|
|
Hi,
there is an Edit button on each of your messages, so there is no need to start a new thread to fix or add something that is already in some thread.
|
|
|
|
|
Hi!
My work mate have asked me to program a software which he could see when he started his computer and when he shuts the computer down.
He would like a to save this information in a text file.
I have no problem creating a Console Application to run when Windows was started using Windows auto start folder in the Start/Program-meny.
But the opposite, when Windows is closing down, I have no clue how to do.
Any ideas? I would prefer to have both functions in the same program, if that could be arranged easily.
/Mc_Topaz
|
|
|
|
|
Sorry for this dubble post
|
|
|
|
|
Hi.
I'm trying to do something using the DirectX.AudioVideoPlayback, but I'm "lost".
I need to detect some events, mouse click and mouse move in a movie playing panel.
I can get the mouse move event, but I can't the mouse click (the ideia is to store a selected point).
How can I do it? I tried to read the directx documentation, but I couldn't find what I'm looking for.
Can you help me?
Thanks
|
|
|
|
|
|
Hi, thanks for your answer... I will see it carefull.
I tryed another way to solve it (maybe not a very correct one) which consists in adding a transparent panel and using its mouse events.
I tryed to do it, and it does exactly what I want.
|
|
|
|
|
Dear All,
I have a query that has some parameters:
(
SELECT DISTINCT
T.TICKET_NUMBER AS TicketNum, A.DESCRIPTION AS Action, O.SYMBOL_CODE AS Symbol, T.TRADE_PRICE AS Price, T.VOLUME_TRADED AS FillVol,
T.EXTENDED_PRICE AS TotalValue, T.SUBMITTED_TIME AS ActTime, T.SUBMITTED_DATE AS TransDate
FROM TSDETL AS T INNER JOIN
TSORDR AS O ON O.SUBMITTED_DATE = T.SUBMITTED_DATE AND O.TICKET_NUMBER = T.TICKET_NUMBER INNER JOIN
TSORDA AS A ON O.ORDER_ACTION = A.ACTION_CODE
WHERE (T.SUBMITTED_DATE = @SUBMIT_DATE) AND (T.VOLUME_TRADED >= @Volume) AND (T.TICKET_NUMBER IS NOT NULL) AND (O.SYMBOL_CODE= @Symbol)
ORDER BY ActTime DESC
)
I passed the three parameters (@SUBMIT_DATE, @Volume, @Symbol) successfully, but I want to read the operator (>= or <=) as a parameter...I have a combo box with >= and <=, and I want to pass the value of this combo into the query.
How can I do this???
this is because the operator may be >= or <=, and I don't want to write two queries.
Kind Regards
OBarahmeh
|
|
|
|
|
Add a parameter of type BIT , and set it to "0" when you want to perform a "<=" and set it to "1" whenever you want to perform a ">=".
You can than add an IF -ELSE -ENDIF construction to differentiate between the two queries;
IF @MyBIT = 0 THEN
BEGIN
SELECT [..]
WHERE >=
END
ELSE
BEGIN
SELECT [..]
WHERE <=
END Enjoy
I are troll
|
|
|
|
|
sorry for posting the same question in two places.
I tried your solution as the following:
declare @operator bit;
set @operator = 1;
(
SELECT DISTINCT
T.TICKET_NUMBER AS TicketNum, A.DESCRIPTION AS Action, O.SYMBOL_CODE AS Symbol, T.TRADE_PRICE AS Price, T.VOLUME_TRADED AS FillVol,
T.EXTENDED_PRICE AS TotalValue, T.SUBMITTED_TIME AS ActTime, T.SUBMITTED_DATE AS TransDate
FROM TSDETL AS T INNER JOIN
TSORDR AS O ON O.SUBMITTED_DATE = T.SUBMITTED_DATE AND O.TICKET_NUMBER = T.TICKET_NUMBER INNER JOIN
TSORDA AS A ON O.ORDER_ACTION = A.ACTION_CODE
WHERE (T.SUBMITTED_DATE = '20090405') AND (CASE WHEN @operator = 1 THEN T.VOLUME_TRADED >= 500 ELSE T.VOLUME_TRADED <= 500 END)
AND (T.TICKET_NUMBER IS NOT NULL) AND (O.SYMBOL_CODE= 'BOP')
ORDER BY ActTime DESC
)
but this did not work , it gives me an error :
Msg 102, Level 15, State 1, Line 10
Incorrect syntax near '>'.
Kind Regards
OBarahmeh
|
|
|
|
|
My apologies, I didn't mean to refer to a CASE statement. What you're looking for is a simpeler IF statement;
DECLARE @operator BIT;
SET @operator = 1;
IF @operator = 1 THEN
BEGIN
SELECT DISTINCT
T.TICKET_NUMBER AS TicketNum,
A.DESCRIPTION AS Action,
O.SYMBOL_CODE AS Symbol,
T.TRADE_PRICE AS Price,
T.VOLUME_TRADED AS FillVol,
T.EXTENDED_PRICE AS TotalValue,
T.SUBMITTED_TIME AS ActTime,
T.SUBMITTED_DATE AS TransDate
FROM TSDETL AS T
INNER JOIN TSORDR
AS O ON O.SUBMITTED_DATE = T.SUBMITTED_DATE
AND O.TICKET_NUMBER = T.TICKET_NUMBER
INNER JOIN TSORDA
AS A ON O.ORDER_ACTION = A.ACTION_CODE
WHERE (T.SUBMITTED_DATE = @SUBMIT_DATE)
AND (T.VOLUME_TRADED >= @Volume)
AND (T.TICKET_NUMBER IS NOT NULL)
AND (O.SYMBOL_CODE= @Symbol)
ORDER BY ActTime DESC
END
ELSE
BEGIN
SELECT DISTINCT
T.TICKET_NUMBER AS TicketNum,
A.DESCRIPTION AS Action,
O.SYMBOL_CODE AS Symbol,
T.TRADE_PRICE AS Price,
T.VOLUME_TRADED AS FillVol,
T.EXTENDED_PRICE AS TotalValue,
T.SUBMITTED_TIME AS ActTime,
T.SUBMITTED_DATE AS TransDate
FROM TSDETL AS T
INNER JOIN TSORDR
AS O ON O.SUBMITTED_DATE = T.SUBMITTED_DATE
AND O.TICKET_NUMBER = T.TICKET_NUMBER
INNER JOIN TSORDA
AS A ON O.ORDER_ACTION = A.ACTION_CODE
WHERE (T.SUBMITTED_DATE = @SUBMIT_DATE)
AND (T.VOLUME_TRADED <= @Volume)
AND (T.TICKET_NUMBER IS NOT NULL)
AND (O.SYMBOL_CODE= @Symbol)
ORDER BY ActTime DESC
END You can make this stored procedure even simpeler by splitting the query into;
* a view that does the selection of the fields and the joins
* put the filter- and order-statements in a select-query that you run against the aforementioned view
I hope this helps
I are troll
|
|
|
|
|