CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Aug 2010
    Posts
    3

    ADO SHAPE COMMAND in ADO.NET

    Hi,

    I am migrating a code from ADO to ADO.NET. Here i am stuck with the SHAPE statement in sql query that is used in ADO. Please help me out with the equivalent code for ADO.NET



    sql= " ((SHAPE { " + sql1+ " } AS SECONDARY APPEND ";
    sql= sql+ " ({ " + sql2+ " } AS PROCEDURALSOURCE RELATE 'STASKID' TO 'TASKID') AS PROCEDURALSOURCE, ";
    sql= sql+ " ({ " + sql3+ " } AS TASKAREA RELATE 'STASKID' TO 'TASKID') AS TASKAREA, ";
    sql= sql+ " ({ " + sql4+ " } AS REPEATS RELATE 'STASKID' TO 'STASKID') AS REPEATS, ";
    sql= sql+ " ({ " + sql5+ " } AS SECONDARYUOM RELATE 'STASKID' TO 'TASKID') AS SECONDARYUOM)";
    sql= sql+ " AS SECONDARY RELATE 'TASKID' TO 'TASKID') AS SECONDARY";

    where sql1, sql2, sql3, sql4, sql5 are complex select statements. It gives an invalid sql statement error in oracle db when i execute this.

    It would be great if some one helps me out with equivalent code in ado.net using datasets or some other thing. Thanks.

  2. #2
    Join Date
    Dec 2007
    Posts
    234

    Re: ADO SHAPE COMMAND in ADO.NET

    Don't have any Oracle experience, but DB errors like this are pretty much handled the same way:
    1) Print out the SQL statement after you have assembled it...
    2) Copy it
    3) Paste it and run it against your oracle database...
    That should help get you closer to where the problem is.

    -tg
    * I don't respond to private requests for help. It's not conducive to the general learning of others.-I also subscribe to all threads I participate, so there's no need to pm when there's an update.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help - how to remove eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to???
    * On Error Resume Next is error ignoring, not error handling(tm). * Use Offensive Programming, not Defensive Programming.
    "There is a major problem with your code, and VB wants to tell you what it is.. but you have decided to put your fingers in your ears and shout 'I'm not listening!'" - si_the_geek on using OERN
    MVP '06-'10

  3. #3
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: ADO SHAPE COMMAND in ADO.NET

    Take a look at this. Your syntax doesn't look right:

    Code:
            Set rsLvRecordset = .Execute("SHAPE {SELECT c.CustomerName As Customer, c.CustomerID FROM Customers c ORDER BY c.CustomerName} As Customers" _
                                       & " APPEND ((SHAPE {SELECT oh.OrderNumber As [Order No], oh.CustomerID, oh.OrderHeaderID FROM OrderHeaders oh ORDER BY oh.OrderNumber} As OrderHeaders" _
                                       & "          APPEND ({SELECT od.OrderLine As [Line], od.OrderLineDescription As [Description], od.OrderLineQuantity As Quantity, od.OrderHeaderID FROM OrderDetails od ORDER BY od.OrderLine} As OrderDetails" _
                                       & "          RELATE OrderHeaderID TO OrderHeaderID))" _
                                       & " RELATE CustomerID TO CustomerID)")
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  4. #4
    Join Date
    Aug 2010
    Posts
    3

    Re: ADO SHAPE COMMAND in ADO.NET

    Thanks for the reply.

    I am quering all the queries independently to a dataset and creating parent - child relations in datatables. Thanks for the replies

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured