|
a snippet of your code might help.
Anger is the most impotent of passions. It effects nothing it goes about, and hurts the one who is possessed by it more than the one against whom it is directed.
Carl Sandburg
|
|
|
|
|
Here is the database query... it is dynamically generated in the program...
--------------------------------
declare @StartDate datetime
declare @EndDate datetime
set @StartDate='3/10/2004 8:00:00 AM'
set @EndDate='3/11/2004 7:59:59 AM'
declare @config TABLE
(
Paytable varchar(60),
Skin varchar(60),
Denomination int,
EPSName int,
Configuration varchar(60),
ChangeDate datetime,
RemovalDate datetime,
MACAddress varchar(30),
LegalConfigNumber int,
Bank varchar(30),
Zone varchar(30)
)
declare @playwk TABLE
(
EPSName int,
PaytableName varchar(60) NULL default '',
SkinName varchar(60) NULL default '',
Denomination int NULL default '',
StartDate datetime NULL default 0,
EndDate datetime NULL default 0
)
declare @cashintmp TABLE
(
EPSName int,
StartDate datetime NULL default 0,
EndDate datetime NULL default 0
)
declare @cashintmp2 TABLE
(
EPSName int,
StartDate datetime NULL default 0,
EndDate datetime NULL default 0
)
declare @cashin TABLE
(
EPSName int,
PaytableName varchar(60) NULL default '',
SkinName varchar(60) NULL default '',
Denomination int NULL default '',
CurrentDate datetime NULL default 0,
StartDate datetime NULL default 0,
EndDate datetime NULL default 0
)
declare @cashouttmp TABLE
(
EPSName int,
CurrentDate datetime NULL default 0
)
declare @cashout TABLE
(
EPSName int,
CurrentDate datetime NULL default 0
)
declare @MarketCode int
select @MarketCode=MarketCode from Bingo.dbo.casino
INSERT INTO @config
SELECT RTrim(e.PaytableName), RTrim(e.SkinDescription), g.Denomination,
CAST (e.EPSName AS INTEGER) AS EPSName, RTrim(l.ConfigurationName) As Configuration,
e.ChangeDate, '1jan2100', e.MacAddress, l.SequenceNumber As LegalConfigNumber,
e.BankName As Bank, e.ZoneName As Zone
from Bingo.dbo.EPSConfiguration e
left outer join Bingo.dbo.GameConfig g
ON (e.GameConfiguration = g.SequenceNumber)
left outer join Bingo.dbo.LegalConfiguration l
ON (e.PaytableNumber = l.PaytableNumber)
And (RTrim(e.SkinDescription) = RTrim(l.SkinDescription))
And (g.SequenceNumber = l.GameConfigNumber)
And ((power (2,@MarketCode) & l.validmarkets) <> 0)
WHERE (CAST(e.EPSName AS INTEGER) <> 0)
ORDER BY CAST(e.EPSName As INTEGER)
declare @res TABLE
(
EPSName int,
Amount int,
AmountSum int,
CashInCount int,
CashInType int,
EPSMacAddress varchar(30),
PaytableName varchar(60),
SkinName varchar(60),
Denomination int,
Configuration varchar(60),
LegalConfigNumber int,
Bank varchar(30),
Zone varchar(30),
CurrentDate datetime NULL default 0,
ChangeDate datetime NULL default 0,
RemovalDate datetime NULL default 0
)
declare @res2 TABLE
(
EPSName int,
Amount int,
AmountSum int,
CashInCount int,
CashInType int,
EPSMacAddress varchar(30),
PaytableName varchar(60),
SkinName varchar(60),
Denomination int,
Configuration varchar(60),
LegalConfigNumber int,
Bank varchar(30),
Zone varchar(30),
CurrentDate datetime NULL default 0,
ChangeDate datetime NULL default 0,
RemovalDate datetime NULL default 0
)
INSERT INTO @res
SELECT c.EPSName, c.Amount, c.Amount, 1, c.CashInType,
c.EPSMACAddress, RTrim(e.Paytable), RTrim(e.Skin), e.Denomination,
e.Configuration, e.LegalConfigNumber, e.Bank, e.Zone,
c.CurrentDate, e.ChangeDate, e.RemovalDate
FROM bingohistory.dbo.cashin c
left outer join @config e
ON (RTrim(c.EPSMACAddress) = (RTrim(e.MACAddress)))
WHERE (TestMode = 0) And (currentdate >= @StartDate) and (currentdate <= @EndDate)
declare @nulcnt int
select @nulcnt=count(*) FROM @res
where (ISNULL(RTrim(PaytableName),'') = '')
if (@nulcnt > 0)
Begin
/* some configurations are missing for this old data... so reconstruct */
/* from other table data */
/* get min/max play range for each cashin... */
INSERT INTO @playwk
SELECT EPSName, PaytableName, SkinName, Denomination, MIN(CurrentDate), MAX(CurrentDate)
FROM Bingo.dbo.Play
WHERE (CurrentDate >= DateAdd(Hour,-12,@StartDate)) And (CurrentDate <= DateAdd(Hour,12,@EndDate))
GROUP BY EPSName, PaytableName, SkinName, Denomination
INSERT INTO @playwk
SELECT EPSName, PaytableName, SkinName, Denomination, MIN(CurrentDate), MAX(CurrentDate)
FROM BingoHistory.dbo.Play
WHERE (CurrentDate >= DateAdd(Hour,-12,@StartDate)) And (CurrentDate <= DateAdd(Hour,12,@EndDate))
GROUP BY EPSName, PaytableName, SkinName, Denomination
/* get cashout matching cashins */
INSERT INTO @cashouttmp
SELECT EPSName, CurrentDate
FROM Bingo.dbo.CashOut
WHERE (CurrentDate >= @StartDate) And (CurrentDate <= DateAdd(Hour,2,@EndDate))
INSERT INTO @cashouttmp
SELECT EPSName, CurrentDate
FROM BingoHistory.dbo.CashOut
WHERE (CurrentDate >= @StartDate) And (CurrentDate <= DateAdd(Hour,2,@EndDate))
INSERT INTO @cashout
SELECT EPSName, CurrentDate
FROM @cashouttmp
GROUP BY EPSName, CurrentDate
/* mate cashout to cashin to form the min/max range for the cashin */
INSERT INTO @cashintmp
SELECT i.EPSName, i.CurrentDate,
CASE ISNULL(MIN(o.CurrentDate),'') WHEN '' THEN @EndDate ELSE MIN(o.CurrentDate) END
FROM Bingo.dbo.CashIn i
left outer join @cashout o
ON (i.EPSName = o.EPSName) And (o.CurrentDate >= i.CurrentDate)
WHERE (i.CurrentDate >= @StartDate) And (i.CurrentDate <= @EndDate)
GROUP BY i.EPSName, i.CurrentDate
INSERT INTO @cashintmp
SELECT i.EPSName, i.CurrentDate,
CASE ISNULL(MIN(o.CurrentDate),'') WHEN '' THEN @EndDate ELSE MIN(o.CurrentDate) END
FROM BingoHistory.dbo.CashIn i
left outer join @cashout o
ON (i.EPSName = o.EPSName) And (o.CurrentDate >= i.CurrentDate)
WHERE (i.CurrentDate >= @StartDate) And (i.CurrentDate <= @EndDate)
GROUP BY i.EPSName, i.CurrentDate
/* mate the cashin ranges to the play to obtain configurations from play records */
/* generated within the cashin min/max range */
INSERT INTO @cashin
SELECT c.EPSName, MAX(p.PaytableName), MAX(p.SkinName), MAX(p.Denomination), c.StartDate,
MIN(CASE ISNULL(p.StartDate,'') WHEN '' THEN c.StartDate ELSE p.StartDate END),
MAX(CASE ISNULL(p.EndDate,'') WHEN '' THEN c.EndDate ELSE p.EndDate END)
FROM @cashintmp c
left outer join @playwk p
ON (c.EPSName = p.EPSName) And ((c.StartDate >= p.StartDate) Or (p.EndDate <= c.EndDate))
GROUP BY c.EPSName, c.StartDate
/* now match the whole thing together... */
INSERT INTO @res2
SELECT r.EPSName, r.Amount, Sum(r.AmountSum), Sum(r.CashInCount), r.CashInType, MAX(r.EPSMACAddress),
MAX(RTrim(r.PaytableName)), MAX(RTrim( r.SkinName )), MAX(RTrim( r.Denomination )),
MAX(Configuration), MAX(LegalConfigNumber), MAX(Bank), MAX(Zone),
r.CurrentDate, MIN(r.ChangeDate), MAX(r.RemovalDate)
FROM @res r
WHERE (ISNULL(r.PaytableName,'') <> '') And (ISNULL(r.SkinName,'') <> '') And (ISNULL(r.Denomination,0) <> 0)
GROUP BY r.EPSName, r.CurrentDate, r.Amount, r.CashInType
ORDER BY r.EPSName, r.Amount, r.CashInType
INSERT INTO @res2
SELECT r.EPSName, r.Amount, Sum(r.AmountSum), Sum(r.CashInCount), r.CashInType, MAX(r.EPSMACAddress),
MAX(RTrim( c.PaytableName )), MAX(RTrim( c.SkinName )), MAX(RTrim( c.Denomination )),
MAX(Configuration), MAX(LegalConfigNumber), MAX(Bank), MAX(Zone),
r.CurrentDate, MIN(r.ChangeDate), MAX(r.RemovalDate)
FROM @res r
left outer join @cashin c
ON (r.EPSName = c.EPSName) And (r.CurrentDate = c.CurrentDate)
WHERE (ISNULL(r.PaytableName,'') = '') Or (ISNULL(r.SkinName,'') = '') Or (ISNULL(r.Denomination,0) = 0)
GROUP BY r.EPSName, r.CurrentDate, r.Amount, r.CashInType
ORDER BY r.EPSName, r.Amount, r.CashInType
End
Else
Begin
/* no missing configuration values on cashin... */
INSERT INTO @res2
SELECT EPSName, Amount, Sum(AmountSum), Sum(CashInCount), CashInType,
MAX(EPSMACAddress), MAX(RTrim(PaytableName)), MAX(RTrim(SkinName)), MAX(Denomination),
MAX(Configuration), MAX(LegalConfigNumber), MAX(Bank), MAX(Zone),
CurrentDate, MIN(ChangeDate), MAX(RemovalDate)
FROM @res
GROUP BY EPSName, CurrentDate, Amount, CashInType
ORDER BY EPSName, Amount, CashInType
End
/* clean up anything still missing configuration values */
UPDATE @res2 set EPSMacAddress='[UNKNOWN]' WHERE (ISNULL(EPSMacAddress,'') = '')
UPDATE @res2 set PaytableName='[UNKNOWN]' WHERE (ISNULL(PaytableName,'') = '')
UPDATE @res2 set SkinName='[UNKNOWN]' WHERE (ISNULL(SkinName,'') = '')
UPDATE @res2 set Denomination=0 WHERE (ISNULL(Denomination,0) = 0)
UPDATE @res2 set Configuration='[UNKNOWN]' WHERE (ISNULL(Configuration,'') = '')
UPDATE @res2 set LegalConfigNumber=99999 WHERE (ISNULL(LegalConfigNumber,0) = 0)
SELECT * from @res2
--------------------------------------
Here is where I am running the query...
:
:
:
dbData = dbRead.ReadDataSet(SQLSelect2, "CashIn", ProcessTimeout);
if (dbData.Tables == null)
{
----- debugger shows it is not ending up here -------
MyLogFile.Warning( "No data returned from CashIn!" );
if (dbRead.Exception == true)
MyLogFile.Error(dbRead.ExceptionMsg);
}
else if (dbData.Tables.Count <= 0)
{
----- debugger shows it is ending up here -------
MyLogFile.Warning( "No data returned from CashIn!" );
if (dbRead.Exception == true)
MyLogFile.Error(dbRead.ExceptionMsg);
}
else if (dbRead.Exception == false)
{
--------- got data so process it ----------
:
:
:
public class DataAccess
{
:
:
:
private string ErrorMessage;
public string ExceptionMsg
{
get
{
string Msg = "Ok";
if (Exception == true)
Msg = ErrorMessage;
Exception = false;
return Msg;
}
}
private bool GotException = false;
public bool Exception
{
set
{
GotException = false;
ErrorMessage = "";
}
get {return GotException;}
}
public DataSet ReadDataSet( string SQLQuery, string dsName, int TimeOut )
{
Exception = false;
dbCommand = new OdbcCommand(SQLQuery, dbConnect);
dbAdapter = new OdbcDataAdapter();
dbData = new DataSet();
dbAdapter.SelectCommand = dbCommand;
---- debugger confirmed that "TimeOut" is 600 here ----
if (TimeOut >= 0)
dbCommand.CommandTimeout = TimeOut;
try
{
dbAdapter.Fill(dbData, dsName);
}
catch (System.Data.Odbc.OdbcException err)
{
---- this is not tripped ----
GotException = true;
ErrorMessage = err.Message.ToString() + ". " + ReadException;
if (LogFileSet==true)
{
MyLog.WriteLine(ErrorMessage);
MyLog.WriteLine( "SQL Query: " );
MyLog.WriteLine( SQLQuery );
}
if (DoingTransaction == true)
Rollback();
}
catch (System.Exception err)
{
--- this is not tripped --------
GotException = true;
ErrorMessage = err.Message.ToString() + ". " + ReadException;
if (LogFileSet==true)
{
MyLog.WriteLine(ErrorMessage);
MyLog.WriteLine( "SQL Query: " );
MyLog.WriteLine( SQLQuery );
}
if (DoingTransaction == true)
Rollback();
}
catch
{
----- this is not tripped ----
GotException = true;
ErrorMessage = ReadException;
if (LogFileSet==true)
{
MyLog.WriteLine(ErrorMessage);
MyLog.WriteLine( "SQL Query: " );
MyLog.WriteLine( SQLQuery );
}
if (DoingTransaction == true)
Rollback();
}
--- it proceeds from the "fill()" command ----
--- directly to here -------
return dbData;
}
:
:
:
}
--------------------------
And here is the snippet from the log...
2005Feb28 151252 STATUS Getting CashIn data...
2005Feb28 151332 WARNING No data returned from CashIn!
2005Feb28 151332 STATUS Getting Play data...
2005Feb28 151336 STATUS Processing Play data...
2005Feb28 151337 STATUS Play records processed: 163
2005Feb28 151337 STATUS Processing CashOut records...
2005Feb28 151337 STATUS CashOut records processed: 1244
|
|
|
|
|
if all that stuff at the top is really contained in SQLSelect2, I'm not surprised it doesn't work. That is a multistep batch combining data schema definition and multiple operations. It is likely the SQlCommand returns after the first operation (which produces no results). The OdbcCommand expecxts only a single sql statement in the commandtext, not a batch of statements.
A more robust way to implement this would be to make it into a stored procedure, and execute the procedure, passing in only the variable parameters. the procedure can contain all this, and will appear as a single statement that returns the result of the final select to the OdbcCommand object.
What is the underlying database engine here? Apparently not SQL server, since you are using the Odbc classes instead of the more efficient SqlClient namespace versions.
Anger is the most impotent of passions. It effects nothing it goes about, and hurts the one who is possessed by it more than the one against whom it is directed.
Carl Sandburg
|
|
|
|
|
1. It IS SQL Server, and I tried to originally use the SqlClient stuff. However, the database connectivity was originally oriented around a VC++ ODBC type of connect string (decision made before I joined the company). The SqlClient connect string did not support certain connectivity options supported by ODBC and so could not connect.
2. The query worked fine before I added the stuff to get the "missing" configuration information. Since the program is released with new features more often than the server/database, then I thought the direct query was better since to convert this to a stored procedure means I also have to implement some way to manage/update the stored procedures, on the fly, separate from the server. I have already had to do this with a report viewer program, and it is quite cumbersome, especially if the administrator login/password gets changed. This is not written for an in-house system, but rather for hundreds of customer sites to query game play data to a comma delimited file for import into separate centralized accounting systems. So, I am constantly changing/updating it to accomodate new requested features, which means the queries tend to change with each release. So, in this case, I would prefer to avoid stored procedures if at all possible.
|
|
|
|
|
After trying everything else of which I could think, I converted it to a stored procedure, and it is still giving me the exact same results. I log what argument values I am passing to the stored procedure, I then cut and paste those values to Query Analyzer to execute the stored procedure, and the procedure runs and gives me over 6000 records. However, when I run the program, it pauses for the same amount of time as QA on the execution of the stored procedure but the DataSet still comes back with an empty table with no exceptions/errors/...
|
|
|
|
|
Ok, I have done some more experimentation. From what I can determine, the longer the wait for data, the less likely it will get anything. It is apparently returning BEFORE it gets data on some queries.
When I do a query for a small bit of data, which it retrieves in < 10 seconds from a fairly small database, it usually gets the data back.
However, if I query against a larger database, which should return over 6000 records in one specific query, it takes about 45 seconds to complete the query and it never gets data. It does not matter whether it is issuing the query above or calling a stored procedure.
I am not getting an error back, such as a query timeout error, because the try/catch handlers do not fire. It is almost as if the "fill()" command has its own independant timeout, separate from the odbccommand timeout.
|
|
|
|
|
Hi,
I wrote a small application console application which executes another program along the way. Is it possible to intergrate the small program into my application and have it execute from there. So i will have only one executable ?
|
|
|
|
|
Not really. You could package the other .EXE into a resource, which would get stored into your console .EXE, but in order for you to launch it, you'd have to unpack it and save it back to a file, then launch. So if you have to unpack it back into an .EXE, what's the point?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I want to call a function written in a C# DLL from inside Dolphin Smalltalk. Currently I can call an external library like a native Win32 function in a DLL using a prototype and following the calling convention (stdcall, cdecl). An example in Dolphin:
" BOOL AppendMenu(
HMENU hMenu, // handle to menu
UINT uFlags, // menu item flags
UINT uIDNewItem, // menu item identifier or pop-up menu handle
LPCTSTR lpNewItem // menu item content
);"
<stdcall: bool AppendMenuA handle dword dword lpstr>
^self invalidCall
But a friend tells me DLLs generated from Visual Studio C# aren't PE compatible.
Any tips to achieve this? I'll appreciate any help.
regards
|
|
|
|
|
He's right, they're not. In order for this to work, you have to expose your C# methods and properties to COM. Then your SmallTalk code should be able to go through the COM interface to get at these functions.
You might want to start by reading Exposing .NET Framework Components to COM[^] on MSDN.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
i want to implement these mathematical function in C# and want a starting point or algorithm please help to do this.
i want to do that i pass input values and the program return me the integrated values after applying limits. same as with derivative
please help me to strat this i am new in C#.
thanks waiting for early reply
bye
|
|
|
|
|
Are you talking about writing a function that takes just numbers as parameters does a little math on them and returns a result? Or are you talking about passing a mathematical function (x=Cos(3y)) to this function and having the return value be the resulting mathematical function? Forgive me, my Calculus is very rusty...
One is easy, just write to code to do the actual math of the mathematical function (supply a number for 'y' and return a value for 'x'.
The other, actually figuring out the integeration, is exceeding difficult! You might want to look into WolframResearch's Mathematica[^].
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
As far as simple dervatives use Regular Expressions to parse the function. As the other guy said.. integration will be painfull, but go for it, it would be interesting to see an article from your findings.
-Steven Hicks
CPACodeProjectAddict
|
|
|
|
|
Hi everybody,
I write an application that has some child-forms and an MDI form. There is a child-form that use a DataGrid binding with a DataTable. What I want to do is when user is adding a new row on the DataGrid, and the focus is moved to another child-form, the DataSource of the DataGrid (i.e the DataTable) should be updated to the database.
I tried to handle the 'Leave' or 'LostFocus' event of the DataGrid, but the new row was not added to the DataSource of the DataGrid on those events. How can I solve this problem?
Thank you.
|
|
|
|
|
How to overwrite local files?
I used "FileMode.Append" and "FileMode.OpenOrCreate". However, they couldn't give me a corret result.
Please Help
Regards,
RockRock
|
|
|
|
|
Well, Append will, obviously, append to the end of the file, not overwrite it. The other flag will give you what you want. But, since you haven't supplied any of your code and any error messages, there's nothing we can do to help you.
It's as simple as opening the file and start writing. There's no magic to this.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi,
I have a panel control in my application. The Paint event of panel control is overrided to show some solid grid line and measures (like scale) on my panel control.
I have a collection of label controls (not less than 250 - 300 in all time) in that panel , which we can drag or drop anywhere inside the panel region.
I am overriding paint method of my custom label or labels which is there inside the panel.
My problem start here,
1. the moment i start dragging the label control in side the panel , the label show transparent shadow of that label control which i am dragging .
2. If i hold my mouse for a second , that is in between drag and drop. The control got heavy flickering. I tried Double buffering and related tricks using SetStyle() method. But still there is no change in status.
3. Last and most important issue that i am facing is, location of mouse cursor.
i.e., I need to place controls (custom labels) in some exact locations (measured location). But i can't able to control mouse cursor. If i start dragging , then my mouse will be near to 10 cm far from my control which i am dragging.
Really got stuck . Any Idea ?.
Sreejith Nair
[ My Articles ]
|
|
|
|
|
How can i do it?
How can get and work on a specified pixel of bitmap as in this way:
bitmap[34][23] = Color.White
|
|
|
|
|
|
any one give the code for login page
username pswd
submit nutton(code for click event)
kindly give me coding help
chand
|
|
|
|
|
Your question is a little vague. How do you plan to authenticate users (e.g. will you perform a lookup against a database; do you keep your user information in a text/XML file; are user IDs and passwords hard coded; how are passwords secured etc. ?).
If all you want is a form for users to enter user IDs and passwords (and assuming you're using VS), just create a new WinForms app, add a new Windows form or use the default form (Form1), and drag 2 textbox controls from the toolbox to the form surface. Then select the textbox you plan to use for the password and set its PasswordChar property to whatever character you want to display instead of the actual text of the password.
Next, add a button to the form, and set its text property to "Submit" or "Log In" or whatever makes you happy.
Finally, add a method that handles the Click event of the button (double-click the button on the design surface and this method will be stubbed out for you and the cursor will move to the stubbed handler method). Insert whatever logic applies to the way you want to authenticate users in the button's Click event handler method (or make a call to another method/type that handles user login), and you're done.
The most exciting phrase to hear in science, the one that heralds the most discoveries, is not 'Eureka!' ('I found it!') but 'That's funny...’
|
|
|
|
|
Thanks for reply great . can u help me in coding.
u r idea is vgood . pl give me coding it will help me a lot(i wnt code pl give me).
pl its vurgent for me.
waiting for u r reply
chand
|
|
|
|
|
It would be kind of pointless for me to provide any actual code, since I don't really know (except in vague terms) what you're trying to do.
Instead, I would recommend that you search the codeproject site or just google for an example. There are, I'm sure, hundreds of them on the internet.
For example:
This is a WinForms quiz application that includes a login page.[^]
Good luck.
The most exciting phrase to hear in science, the one that heralds the most discoveries, is not 'Eureka!' ('I found it!') but 'That's funny...’
|
|
|
|
|
Hello everyone,
I am currently trying to code a little Subnetting-Calc, trying to get as close to .NET-Standards as I can (and thus, get some practise with .NET-Standards).
One thing I want to do is to return a networks broadcast-address based on Client IP and subnet-mask.
I have a method getBroadcastAddressAsLong (which accepts 2 Params representing SubnetMask and Client-IP and returns the BroadcastAddress as LONG).
During testing, I first wanted to try if the IP-Addresses were valid, so I tried to create 2 IPAddresses which should be identical, one long (0xFFFFFF00) and one byte[] (0,255,255,255) and passed them to the IPAddress Constructor.
Unfortunatley, the byte[] constructor fails, throwing an ArgumentException with the "additional info: addres" (sic!).
That really does not help much, so it would be great if someone could tell me, what to pass along to get that byte[] constructor to work".
Version of .NET FW is 1.1 SP1
Cheers
Sid
|
|
|
|
|
sebs2004 wrote:
one long (0xFFFFFF00) and one byte[] (0,255,255,255) and passed them to the IPAddress Constructor.
Those are definitaly not the same.... try byte[] { 255,255,255,0 } instead...
xacc-ide 0.0.12 now with C#, MSIL, C, XML, ASP.NET and HLSL coloring - Screenshots
|
|
|
|
|