views:

82

answers:

0

im new on informix and i did a webservice on .net c# that calls 3 different store procedures. What i like to know is if Informix or .Net opens 3 different connections to execute this procedures or just opens 1 en re-use it for each of the procedures also if i execute this webservice on different pc's each of the pc's will open a connection? how do i control this on IBM Informix?

public DataTable webservice(string something, string something)
        {
            IfxConnection myconn = new IfxConnection();
            myconn.ConnectionString = ConfigurationManager.ConnectionStrings ["informixConnection"].ConnectionString;
            myconn.Open();
            myreturn = function1(something, myconn);
            myreturn.Merge(function2(something, myconn);
            myreturn.Merge(function3(something, myconn);
            myconn.Close();
            return myreturn;
        }



private DataTable function1(string something, IfxConnection myconn)
        {
            IfxCommand cmd = new IfxCommand("storeprocedure", myconn);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("somethingi", IBM.Data.Informix.IfxType.VarChar, 45).Value = something;
            try
            {
                DataTable myreturn = new DataTable();
                IfxDataAdapter adapter = new IfxDataAdapter(cmd);
                DataSet ds1 = new DataSet();
                adapter.Fill(ds1);
                myreturn = ds1.Tables[0];

                return myreturn;
            }
            catch (IfxException ex)
            {
                throw new Exception("Exception " + ex);
            }
        }