|
I'm working on an ASP.Net application accessing couple of database tables from AS400 mainframe server database . In the code there's an SQL Query, which seems very complicated to me, the person who did the actual coding is no more with our firm.
Right now the query is producing some kinda result which is wrong. So can anyone please help me out in finding what's wrong with the SQL query? The SQL query is attached below:
Me.OdbcSelectCommand2.CommandText = "SELECT SAMFILE.STAYP.SCLINT, SAMFILE.STAYP.SADMHH, SAMFILE.STAYP.SADMYY, SAMFILE.STAYP.SADMMM, SAMFILE.STAYP.SBLDG, SAMFILE.STAYP.SADMDD, SAMFILE.STAYP.STRMCD, SAMFILE.STAYP.STRMHH, SAMFILE.STAYP.STRMYY, SAMFILE.STAYP.STRMMM, SAMFILE.STAYP.STRMDD, SAMFILE.CLIENTP.CNAME, SAMFILE.CLIENTP.CRACE1, SAMFILE.CLIENTP.CRACE2, SAMFILE.CLIENTP.CRELIG, SAMFILE.CLIENTP.CSEX, SAMFILE.CLIENTP.CBTHHH, SAMFILE.CLIENTP.CBTHYY, SAMFILE.CLIENTP.CBTHMM, SAMFILE.CLIENTP.CBTHDD, SAMFILE.REFSRP.REFSDS, SAMFILE.STAYP.SMDPM, SAMFILE.STAYP.SREFRL, SAMFILE.STAYP.SADRG1, SAMFILE.STAYP.SADRG2, SAMFILE.RACETP.RACEDS, SAMFILE.RELIGP.RELGDS, SAMFILE.STAYP.SADMAG FROM SAMFILE.REFSRP, SAMFILE.RELIGP, SAMFILE.RACETP, { oj SAMFILE.STAYP LEFT OUTER "JOIN SAMFILE.CLIENTP ON SAMFILE.STAYP.SCLINT = SAMFILE.CLIENTP.""CLNT#""} WHERE SAMFILE.REFSRP.REFSCD = SAMFILE.STAYP.SREFRL AND SAMFILE.RELIGP.RELGCD = SAMFILE.CLIENTP.CRELIG AND SAMFILE.RACETP.RACECD = SAMFILE.CLIENTP.CRACE1" // After some loop conditions, the OdbcSelectCommand2 is used in 4 concatenations like this. OdbcSelectCommand2.CommandText = OdbcSelectCommand2.CommandText & " AND (({ fn CONCAT({ fn CONCAT({ fn CONCAT({ fn CONCAT({ fn CONCAT(digits(SADMHH), digits(SADMYY)) }, '-') }, digits(SADMMM)) }, '-') }, digits(SADMDD)) } <= { d '" & End_date_conv & "' })"OdbcSelectCommand2.CommandText = OdbcSelectCommand2.CommandText & " AND ({ fn CONCAT({ fn CONCAT({ fn CONCAT({ fn CONCAT({ fn CONCAT(digits(STRMHH), digits(STRMYY)) }, '-') }, digits(STRMMM)) }, '-') }, digits(STRMDD)) } >= { d '" & Start_date_conv & "' })"OdbcSelectCommand2.CommandText = OdbcSelectCommand2.CommandText & " OR ({ fn CONCAT({ fn CONCAT({ fn CONCAT({ fn CONCAT({ fn CONCAT(digits(SADMHH), digits(SADMYY)) }, '-') }, digits(SADMMM)) }, '-') }, digits(SADMDD)) } <= { d '" & End_date_conv & "' })"OdbcSelectCommand2.CommandText = OdbcSelectCommand2.CommandText & " AND (SAMFILE.STAYP.STRMCD = 0))" // To get the desired result, one more table is suppossed to be used, i.e MOVESP table, but its a tremendously huge table containing records of more than 30+ years and each id is having multiple records and to get the expected result it should be used in the code as something like this. But everytime I try this, it throws an exception "System.outofmemoryexception". I tried increasing the physical and virtual RAM and even timeout durations too but all in vain. OdbcSelectCommand2.CommandText = OdbcSelectCommand2.CommandText & " AND (SAMFILE.MOVESP.MCODE = 'A'))"
Note:
This query works but it fetches wrong information. In the below query I want to replace the last condition (SAMFILE.STAYP.STRMCD = 0 ) with this new condition (SAMFILE.MOVESP.MCODE = ""A"" ) and I believe this will make it to fetch the right values to display on the crystal report. But whenever I try to include this new code alongwith other necessary changes it shoots up an erorr message. And the other changes which I make are like :
1. Adding a new element by the name "MCODE " in "as400ds2.xsd "
2. Adding [New System.Data.Common.DataColumnMapping("MCODE", "MCODE")] into the OdbcDataAdapter.TableMappings.AddRange section.
Thanking you all in anticipation
|
|
|
|
|
YOu say the query "shoots up an error message". Care to post it? we're not psychics.
|
|
|
|
|
cool down bro........!!!
reg. the erro msg : whn i add this piece of code in the end
of the SQL string (SAMFILE.MOVESP.MCODE = ""A"" ),
the error message is : ERROR [42S22] [IBM][iSeries ACCESS ODBC
Driver][DB2 UDB]SQL0206 - Column A not in specified tables.
and whn I change it to : SAMFILE.MOVESP.MCODE = 'A' ,
it takes a long time to process the webpage and after a prolonged
period of time, shows the "Page cannot be displayed" error message.
|
|
|
|
|
Just fishing here, but is journaling enabled on the AS/400 file?
|
|
|
|
|
|
look dear, if u can put in some valuable comments, pls go ahead, otherwise dont try to rule anybody, u get tht.
|
|
|
|
|
f*** off a**hole
led mike
|
|
|
|
|
Please stop it.
modified on Tuesday, December 9, 2008 3:36 PM
|
|
|
|
|
Nice job changing that old post I linked to. Still I saw it so, f*** off a**hole.
led mike
|
|
|
|
|
very bad Led......i'm surprised who ur employer is...........
|
|
|
|
|
Perhaps, however
Reality Strikes wrote: please have basic manners
you proved you are a giant hypocritical turd with that post given your reply to Graus which you have now deleted in an attempt to hide the truth thereby also proving you are without honor and integrity. So for the last time (today), f*** off a**hole.
led mike
|
|
|
|
|
i dont know wht the heck u r blabbering..........take a day off from u work and relax.........u will feel better........!!!
led mike wrote: So for the last time (today), f*** off a**hole.
why making it the last time, say it over and over..........coz thts wht ur parents taught u..........say it very proudly.........!!!
|
|
|
|
|
Reality Strikes wrote: i dont know wht the heck u r blabbering
Good, now we can add "lying sack of sh*t" to your description.
led mike
|
|
|
|
|
didnt u see tht icon next to ur name..........seems u r in deep s*** man.........!!!
u r crude uncouth ill-bred person lacking culture or refinement and we prefer calling thm as BARBARIANS.
|
|
|
|
|
plz dnt us txtspk in da 4rm.
|
|
|
|
|
without the last piece of code [SAMFILE.MOVESP.MCODE = A ] also, this query works but it gives an incorrect result.
and the only code which can fetch the true values wud be if we include the MCODE code.
|
|
|
|
|
I think your problem is outside the scope of this forum, and maybe of any forum here.
|
|
|
|
|
Have you tried getting a wrking query directly against the database without involving odbc?
When it works there inclue it in your asp page.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
as mentioned, the database is on AS/400 Mainframe server.
without odbc how can i chk the query.
can u guide me on how to proceed with this?
|
|
|
|
|
I feel really sorry for your employer, letting you lose with such equipment...
xacc.ide - now with TabsToSpaces support IronScheme - 1.0 beta 1 - out now! ((lambda (x) `((lambda (x) ,x) ',x)) '`((lambda (x) ,x) ',x))
|
|
|
|
|
I have no idea about as400 database utilities, but every database I have ever come across has some utility to allow you to run queries. I suggest you speak to one of your colleagues and find out how to do it.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
|
Hi All!
I'm using the CSEXWB WebBrowser control in my application and I need to allow the javascript within it uninhibited access to the file system, everything works so far but I am presented with an annoying little dialog that says "An ActiveX control on this page may be unsafe to interact with other parts of the page. Do you wish to allow this interaction?"
How can I hide this dialog box and still allow the ActiveX control to be used anyway?
Thanks!
MrWolfy 
|
|
|
|
|
I'm only using Visual C# 2008 Express Edition for a .NET Framework 2.0 project. So, I'm not able to use an assistent creating a connection to a MS SQL 2005 database on another server, it has to be done in code.
The table itself has a field which is automatically a primary key with autoincrement functionality.
Selecting all fields in the table are no problem with SqlConnection-, SqlDataAdapter etc. I'm also able to update an existing entry. My problem is inserting a new row. The new set is added to the table, but I'm not automatically getting back the new Primary Key value in the ID field (it's also not in the DataTable during debugging) . Next time, I'm editing this field, I'm getting an error, of course for updating it needs the new ID, the DataGridView-/ DataTable- Object doesn't know.
Probably it's very easy, but how can this ID can be updated in the DataGridView and let the dataset navigator of the grid stay at the current position (no reload with moving the navigator to the first set).
|
|
|
|
|
dj_jeff wrote: connection to a MS SQL 2005
dj_jeff wrote: The table itself has a field which is automatically a primary key with autoincrement functionality.
Microsoft cleverly hides that information in the documentation[^]
led mike
|
|
|
|
|