none
Oracle database 11G to C# WPF application RRS feed

  • Question

  • Hello,

    I must make a connection from my C# application and the Oracle database 11G
    My questions are.
    What do I have to prepare to succeed? OK google found a lot.
       One   https://www.oracle.com/technetwork/topics/dotnet/utilsoft-086879.html
       Two   https://www.oracle.com/technetwork/developer-tools/visual-studio/downloads/index.html

    Three

    My problems
    I get a script from the client like this

    SCRIPT CREATE TABLE PCB_SERIAL_NUMBERS (PCB_SERIAL_NO_ID NUMBER, -- PRIMARY KEY BATCH_ID NUMBER,
     PANEL_ID NUMBER, 
     POSITION_INDEX VARCHAR2(10),
     MODEL_ID VARCHAR2(40), 
     MODEL_NAME VARCHAR2(40), 
     FG_ID NUMBER, FG_NAME VARCHAR2(40), 
     PCB_SERIAL_NO VARCHAR2(25),
      
    I must call StoredProcedure function.  
    
      PKG_PCB_SERIAL_NUMBERS. GET_NO_OF_PANELS_UNPROCESSED ( p_in_batch_id NUMBER,
      p_out_unprocessed_panel_count OUT VARCHAR2, p_out_error_message OUT VARCHAR2);

    Summary:
    With which tool can I execute the script?
    With which tool can I fill the database?
    How is the right way to call StoredProcedure inside C# ?
    I want to be able to control the server/database with a tool? As to use HeidiSQL for MySQL?
    Is it good and useful for any request to open the database? To use using?
     I have about 10 StoredProcedure?
    using (OracleConnection connection = new OracleConnection(Cfg.DbConnectionstring))
    {
    	OracleCommand cmd = new OracleCommand("STACA.GetStatus", connection);
    	cmd.CommandType = CommandType.StoredProcedure;
    
    	cmd.Parameters.Add("retVal", OracleDbType.Int32, ParameterDirection.ReturnValue);
    
    	cmd.Parameters.Add("vchMacAdr", "5c9ad8e11abe");
    	cmd.Parameters.Add("vchId", "50W0DE1");
    	cmd.Parameters.Add("vchNo", "S3250-2");
    	cmd.Parameters.Add("vchStatus", OracleDbType.Varchar2, ParameterDirection.Output);
    	cmd.Parameters["vchStatus"].Size = 1;
    	cmd.Parameters.Add("vchHNo", OracleDbType.Varchar2, ParameterDirection.Output);
    	cmd.Parameters["vchHNo"].Size = 16;
    
    	try
    	{
    		connection.Open();
    		OracleDataAdapter da = new OracleDataAdapter(cmd);
    		cmd.ExecuteNonQuery();
    
    		OracleDecimal d = (OracleDecimal)cmd.Parameters["retVal"].Value;
    		int retValue = d.ToInt32();
    
    		string status = cmd.Parameters["vchStatus"].Value.ToString();
    
    		if (status != "1")

    Thanks in advance for answers.
    With many greetings Markus


      
    Tuesday, January 29, 2019 5:27 PM

Answers

  • The software should be free to use. 

    Hello,
    I will install it, then I will see it.
    Maybe that
    Maybe you know a good guide.
    When I get a script from the customer, how do I import that, I do that with the tools.
    To work, what do I have to ask the customer?
    That would be nice.
    Many greetings Markus


    In my opinion, the client should be supplying you with a test database with everything already setup so that you can use the DBA tools on it to run the script or use C# to run the script. I don't understand this. Have you talked to an Oracle DBA the company has? Have you talked with a program manager? You seem to be treated sparsely on needed information and database usage.
    • Marked as answer by Markus Freitag Saturday, February 2, 2019 11:41 AM
    Friday, February 1, 2019 5:02 PM

All replies

  • Toad for Oracle is freeware. But if you are using Oracle, then why can't you use the Oracle Developer Tool?

    https://softfamous.com/toad-for-oracle/

    Is it good and useful for any request to open the database? To use using?

    It is the optimal approach to opening and datanase connection by using the 'using' statement.

    Oracle uses packages and not stored procedures, which has a package interface and a package body.

    https://www.tutorialspoint.com/plsql/plsql_packages.htm

    Oracle has functions.

    https://www.tutorialspoint.com/plsql/plsql_functions.htm

    Wednesday, January 30, 2019 12:19 AM
  • Hello,
    Thanks for your response.
    I do not have an Oracle license, I am a supplier and need to connect to
    the customer database to query and write back data.
    Not more. So I can not do first a 2 week training.
    I do not need much, just call the functions / packages (stored procedures)
    I do not have to design a database.
    Hope you understand me, what I need.
    I have it.
       Scripts from customer
    I need a instruction, how can I test it.

    That's all.

    Are these assemblies free?
    using Oracle.ManagedDataAccess.Client;
    using Oracle.ManagedDataAccess.Types;

    Thanks in advance.
    With best regards Markus

    Wednesday, January 30, 2019 5:11 PM
  • Hello,
    Thanks for your response.
    I do not have an Oracle license, I am a supplier and need to connect to
    the customer database to query and write back data.
    Not more. So I can not do first a 2 week training.
    I do not need much, just call the functions / packages (stored procedures)
    I do not have to design a database.
    Hope you understand me, what I need.
    I have it.
       Scripts from customer
    I need a instruction, how can I test it.

    That's all.

    Are these assemblies free?
    using Oracle.ManagedDataAccess.Client;
    using Oracle.ManagedDataAccess.Types;

    Thanks in advance.
    With best regards Markus


    The software should be free to use. 
    Wednesday, January 30, 2019 7:43 PM
  • The software should be free to use. 
    Hello,
    I will install it, then I will see it.
    Maybe that
    Maybe you know a good guide.
    When I get a script from the customer, how do I import that, I do that with the tools.
    To work, what do I have to ask the customer?
    That would be nice.
    Many greetings Markus

    Friday, February 1, 2019 4:17 PM
  • The software should be free to use. 

    Hello,
    I will install it, then I will see it.
    Maybe that
    Maybe you know a good guide.
    When I get a script from the customer, how do I import that, I do that with the tools.
    To work, what do I have to ask the customer?
    That would be nice.
    Many greetings Markus


    In my opinion, the client should be supplying you with a test database with everything already setup so that you can use the DBA tools on it to run the script or use C# to run the script. I don't understand this. Have you talked to an Oracle DBA the company has? Have you talked with a program manager? You seem to be treated sparsely on needed information and database usage.
    • Marked as answer by Markus Freitag Saturday, February 2, 2019 11:41 AM
    Friday, February 1, 2019 5:02 PM
  • In my opinion, the client should be supplying you with a test database with everything already setup so that you can use the DBA tools on it to run the script or use C# to run the script. I don't understand this. Have you talked to an Oracle DBA the company has? Have you talked with a program manager? You seem to be treated sparsely on needed information and database usage.

    You are right. I will talk with the project manager, then I will see it.

    Thanks. Best regards Markus

    Saturday, February 2, 2019 11:41 AM