Hi, I want to pass an array of object of different type
to a function and use it in the function.
I am not able to have it working.
Function that create the array...
public virtual DataSet GetFacturesClie ntListeDS(strin g
client)
{
Object[] parametre = new object[4]
{"client",OleDb Type.Char,60,cl ient};
string select = "SELECT distinct
details.d_nfact ure,project.p_n ame FROM project,details
where project.p_clien t = ? and project.p_refno =
details.d_refno and !empty(details. d_nfacture) ORDER BY
d_nfacture";
DataSet myDS = SqlGenericDataS et
(select,"client ","SQLPME","AUC UNE",parametre) ;
return myDS;
}
Function to use the array,
public DataSet SqlGenericDataS et(string sqlquery,string
tablename,strin g ConfigConnectio nKey, string fonction,
Object[] aParameter)
{
SqlConnection GenericConnecti on = new
System.Data.Sql Client.SqlConne ction
(ConfigurationS ettings.AppSett ings[ConfigConnectio nKey]);
SqlCommand GenericCommand = new
System.Data.Sql Client.SqlComma nd(sqlquery,
GenericConnecti on);
for (int a = 1;a<=aParameter .GetLength(0);a ++)
{
GenericCommand. Parameters.Add( (string)aParame ter.GetValue
(a,0),(SqlDbTyp e)aParameter.Ge tValue(a,1),(in t)
aParameter.GetV alue(a,2));
GenericCommand. Parameters[(string)aParame ter.GetValue
(a,0)].Value = (string)aParame ter.GetValue(a, 3);
}
Any idea's??
Carl
to a function and use it in the function.
I am not able to have it working.
Function that create the array...
public virtual DataSet GetFacturesClie ntListeDS(strin g
client)
{
Object[] parametre = new object[4]
{"client",OleDb Type.Char,60,cl ient};
string select = "SELECT distinct
details.d_nfact ure,project.p_n ame FROM project,details
where project.p_clien t = ? and project.p_refno =
details.d_refno and !empty(details. d_nfacture) ORDER BY
d_nfacture";
DataSet myDS = SqlGenericDataS et
(select,"client ","SQLPME","AUC UNE",parametre) ;
return myDS;
}
Function to use the array,
public DataSet SqlGenericDataS et(string sqlquery,string
tablename,strin g ConfigConnectio nKey, string fonction,
Object[] aParameter)
{
SqlConnection GenericConnecti on = new
System.Data.Sql Client.SqlConne ction
(ConfigurationS ettings.AppSett ings[ConfigConnectio nKey]);
SqlCommand GenericCommand = new
System.Data.Sql Client.SqlComma nd(sqlquery,
GenericConnecti on);
for (int a = 1;a<=aParameter .GetLength(0);a ++)
{
GenericCommand. Parameters.Add( (string)aParame ter.GetValue
(a,0),(SqlDbTyp e)aParameter.Ge tValue(a,1),(in t)
aParameter.GetV alue(a,2));
GenericCommand. Parameters[(string)aParame ter.GetValue
(a,0)].Value = (string)aParame ter.GetValue(a, 3);
}
Any idea's??
Carl
Comment