Jump to content
Xtreme .Net Talk

Recommended Posts

Posted (edited)

Hi Iam new here and to .net.

I have aproblem.Iam trying to run a procedure depending upon results from another query.

Iam using visual studio 2008.Language:C#

back end:mysql 5.0.1

.

my code

:

DataColumnCollection drc = myDataSet.Tables["industry1"].Columns;
       DataRowCollection dra = myDataSet.Tables["industry1"].Rows;
 foreach (DataRow dr in dra)
       {
          
DataColumnCollection drc = myDataSet.Tables["industry1"].Columns;
       DataRowCollection dra = myDataSet.Tables["industry1"].Rows;
           foreach (DataColumn col in drc)
           {
           
             
               //prefereed method
                //Console.WriteLine(dr[col]);
//this method should run a procedure sending P3 which is dr[col]
                  runQuery()
               
              
          }
           Console.WriteLine("--------------------------------");
           //Console.WriteLine(dr[col]);
       }

---------------------------

current output is:

 

4 rows and 3 columns.=12 values

i want that for each value using mysqlcommand

a query should be made to a stored procedure:

sending parameters.

lets say P1,P2,P3.

P1-column name,P2-tablename,P3-value.

I want that P1 and P2 should be taken in from the column index :col[],

and table name using the col[] and like wise index.(iam working on it).

my back end procedure:

[highlight=sql]

DROP PROCEDURE `procGetPoints7`//

CREATE DEFINER=`root`@`localhost` PROCEDURE `procGetPoints7`(IN P1 varchar(3),IN P2 varchar(30),IN P3 int(6),OUT pt int(3))

BEGIN

DECLARE req1 varchar(30);

DECLARE ID varchar(10);

 

SET req1=P2;

SET ID=P1;

SELECT Points INTO pt

FROM req1

WHERE req1.ID = (

SELECT s.ID

FROM standard1 s, tblcandidate c

WHERE s.STID = c.STID

AND s.ID =P3 )

LIMIT 0 , 30 ;

END

[/highlight]

Edited by PlausiblyDamp

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...