Andyblg's Blog

June 27, 2012

c# to ebs r12

Filed under: ebs — andyblg @ 11:12
Tags: , ,

i try to connect to ebs r12 and retrieve some data

in ebs check init session

SQL> select count(*) from ap_invoices;

  COUNT(*)
----------
         0

SQL> 
SQL> begin
  2     mo_global.init('SQLAP');
  3     begin fnd_global.apps_initialize(0, 20639, 200); end;
  4  end;
  5  /

PL/SQL procedure successfully completed

SQL> select count(*) from ap_invoices;

  COUNT(*)
----------
     33336

SQL>

in ebs r12 you must use mo_global for init session. in code below remove mo_global.init and check

then in vs 2008 + odac without init session

put on form button and dataGridView1

and for button

private void button1_Click(object sender, EventArgs e)
        {
            String conString = "User Id=apps; Password=apps; Data Source=172.16.21.40:1521/vis; Enlist=False; Pooling=False;";

            OracleConnection con = new OracleConnection();
            con.ConnectionString = conString;

            try
            {
                con.Open();

                OracleCommand cmd = con.CreateCommand();

                // init session              
                //cmd.CommandText = @"begin apps.mo_global.init('SQLAP'); begin apps.fnd_global.apps_initialize(5710, 20639, 200); end; end;";
                //cmd.ExecuteNonQuery();

                cmd.CommandText = "select count(*) from ap_invoices";

                OracleDataAdapter da = new OracleDataAdapter(cmd);
                DataSet ds = new DataSet();
                da.Fill(ds);

                dataGridView1.DataSource = ds.Tables[0];
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

        }

then init session

private void button1_Click(object sender, EventArgs e)
        {
            String conString = "User Id=apps; Password=apps; Data Source=172.16.21.40:1521/vis; Enlist=False; Pooling=False;";

            OracleConnection con = new OracleConnection();
            con.ConnectionString = conString;

            try
            {
                con.Open();

                OracleCommand cmd = con.CreateCommand();

                // init session              
                cmd.CommandText = @"begin apps.mo_global.init('SQLAP'); begin apps.fnd_global.apps_initialize(5710, 20639, 200); end; end;";
                cmd.ExecuteNonQuery();

                cmd.CommandText = "select count(*) from ap_invoices";

                OracleDataAdapter da = new OracleDataAdapter(cmd);
                DataSet ds = new DataSet();
                da.Fill(ds);

                dataGridView1.DataSource = ds.Tables[0];
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

        }

 

for connectiong string:

Using ODP.NET To Call Oracle Apps Stored Procedures Results In Unexpected Behavior On Second Call [ID 1351984.1]

Advertisements

26 Comments »

  1. i would like to read your newer posts, so i will bookmark you. hope to see your updates.http://www.acertemail.com

    Comment by Amina — July 24, 2012 @ 18:00 | Reply

  2. that was very good , i will always be here waiting for more updates.http://www.camisaxadrezmasculina.com

    Comment by Aicha — July 5, 2012 @ 11:35 | Reply

  3. this was a really quality post. in theory i’d like to write like this too. taking time and real effort to make a good article.http://www.mitchwilder.com

    Comment by Clareana — July 4, 2012 @ 22:23 | Reply

  4. 30. I’ve been surfing online more than three hours today, yet I never found any interesting article like yours. It’s pretty worth enough for me. In my view, if all site owners and bloggers made good content as you did, the web will be much more useful than ever before
    hydrolyze scam
    Sloan I will neither confirm nor deny your suspicion until you let me know where I can read more of your writing.

    Comment by larernrendmof — July 3, 2012 @ 10:33 | Reply

  5. thanks for posting this post. i would like to get more information on this.http://www.oiemail.net

    Comment by Deborah — July 2, 2012 @ 17:19 | Reply

  6. nice and clean design.http://www.bmasrl.com

    Comment by Adele — July 2, 2012 @ 17:06 | Reply

  7. this is nice post!http://www.celularcomchip.com

    Comment by Alcinda — July 2, 2012 @ 16:39 | Reply

  8. hey, thanks for that.http://www.expectaculo.com

    Comment by Aurora — July 2, 2012 @ 01:14 | Reply

  9. doing a great job, keep up the work going.http://www.bobesponjajogos.org

    Comment by Alícia — July 1, 2012 @ 14:22 | Reply

  10. the site, very nice and meaningful, keep it uphttp://www.jogosdopicapau.org

    Comment by Areta — July 1, 2012 @ 01:46 | Reply

  11. the post is really informative for me. i liked it very much. keep sharing such important posts.http://www.jogosdahotwheels.com

    Comment by Clenira — June 30, 2012 @ 21:49 | Reply

  12. thanks for the post buddy.http://www.papycom.com

    Comment by Anonymous — June 30, 2012 @ 11:26 | Reply

  13. i loved your intention to help people by writing these posts, thanks for it.http://www.bancobrasil.net

    Comment by Albertina — June 29, 2012 @ 23:57 | Reply

  14. thanks for being so kind with us.http://www.plactual.com

    Comment by Camila — June 29, 2012 @ 23:46 | Reply

  15. not bad!http://www.msnbrasil.net

    Comment by Alejandra — June 29, 2012 @ 18:47 | Reply

  16. just amazing to see the post like that.http://www.advancings.com

    Comment by Carolina — June 29, 2012 @ 15:16 | Reply

  17. nice information for my coursework help.http://www.detetizadoras.net

    Comment by Bridget — June 29, 2012 @ 01:45 | Reply

  18. this stuff is worthy a read.http://www.protesemamaria.com

    Comment by Dejanira — June 28, 2012 @ 22:06 | Reply

  19. i’m very glad i found your site. http://www.realsaude.net

    Comment by Edilaine — June 28, 2012 @ 21:05 | Reply

  20. thanks for taking your time to explain that, i bet everyone likes your articles.http://www.magiccampusbrasil.net

    Comment by Anita — June 28, 2012 @ 18:36 | Reply

  21. nice information for my coursework help.http://www.mangueiraplastica.com

    Comment by Edna — June 28, 2012 @ 17:31 | Reply

  22. every time i come here i am not disappointed. nice post.http://www.mangueiraplastica.com

    Comment by Eliane — June 28, 2012 @ 15:09 | Reply

  23. simple and best post…http://www.extratordetelefone.org

    Comment by Emeline — June 28, 2012 @ 00:25 | Reply

  24. it’s my first time visiting here. and i found so many entertaining stuff in this blog, especially its discussion..http://www.queroouvirmusica.com

    Comment by Alísia — June 27, 2012 @ 23:27 | Reply

  25. this one’s very interesting.http://www.shopfacil.org

    Comment by Adelina — June 27, 2012 @ 21:44 | Reply

  26. write more often please.http://www.detetizadoras.net

    Comment by Catarina — June 27, 2012 @ 20:45 | Reply


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.

%d bloggers like this: