473,782 Members | 2,439 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Array of obj

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
Nov 15 '05 #1
6 1873

Hi Carl,

Where is the problem that the code does not work?
What is your code snippet's function?
However, I found that your aParameter shoud be 2-dimension array.
And your GenericConnecti on should be opened after construct.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

--------------------
| Content-Class: urn:content-classes:message
| From: "Carl" <Ca**@cb-cinc.com>
| Sender: "Carl" <Ca**@cb-cinc.com>
| Subject: Array of obj
| Date: Mon, 25 Aug 2003 19:23:53 -0700
| Lines: 53
| Message-ID: <07************ *************** *@phx.gbl>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="iso-8859-1"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
| Thread-Index: AcNreRgzgUdYKA3 HSZSLulpbpF1Jow ==
| Newsgroups: microsoft.publi c.dotnet.langua ges.csharp
| Path: cpmsftngxa06.ph x.gbl
| Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.langua ges.csharp:1793 02
| NNTP-Posting-Host: TK2MSFTNGXA12 10.40.1.164
| X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.csharp
|
| 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
|
|
|

Nov 15 '05 #2
My trouble is with the array ,how do you iterate trough
it, my syntax is probably not ok.

The line giving me the error in the previous post is

GenericCommand. Parameters.Add( (string)aParame ter.GetValue
(a,0),(SqlDbTyp e)aParameter.Ge tValue(a,1),(in t)
aParameter.GetV alue(a,2));
This is the message I receive,

An unhandled exception of
type 'System.Web.Ser vices.Protocols .SoapException'
occurred in system.web.serv ices.dll

Additional information:
System.Web.Serv ices.Protocols. SoapException: Server was
unable to process request. ---> System.Argument Exception:
Array was not a two-dimensional array.
at System.Array.Ge tValue(Int32 index1, Int32 index2)
at WS_PME.DB.SqlGe nericDataSet(St ring sqlquery, String
tablename, String ConfigConnectio nKey, String fonction,
Object[] aParameter) in f:\structure\pr ojets\vs2003
\pme\ws_pme\com ponents\db_data set.cs:line 92
at WS_PME.DB.GetFa cturesClientLis teDS(String client)
in f:\structure\pr ojets\vs2003
\pme\ws_pme\com ponents\db_data set.cs:line 125
at WS_PME.WSPME.Fa cturesClientLis teDS(String client)
in f:\structure\pr ojets\vs2003
\pme\ws_pme\pme .asmx.cs:line 63
--- End of inner exception stack trace ---
-----Original Message-----

Hi Carl,

Where is the problem that the code does not work?
What is your code snippet's function?
However, I found that your aParameter shoud be 2- dimension array.And your GenericConnecti on should be opened after construct.
Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
--------------------
| Content-Class: urn:content-classes:message
| From: "Carl" <Ca**@cb-cinc.com>
| Sender: "Carl" <Ca**@cb-cinc.com>
| Subject: Array of obj
| Date: Mon, 25 Aug 2003 19:23:53 -0700
| Lines: 53
| Message-ID: <07************ *************** *@phx.gbl>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="iso-8859-1"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300| Thread-Index: AcNreRgzgUdYKA3 HSZSLulpbpF1Jow ==
| Newsgroups: microsoft.publi c.dotnet.langua ges.csharp
| Path: cpmsftngxa06.ph x.gbl
| Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.langua ges.csharp:1793 02| NNTP-Posting-Host: TK2MSFTNGXA12 10.40.1.164
| X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.csharp
|
| 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) aParameter.GetV alue| (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
|
|
|

.

Nov 15 '05 #3
Simplify story.

I want to have one obj array of 4 columns to pass my
parameters for SQL when required, could have multiple
rows or just one.

Columns 1 = string
Columns 2 = OleDbType.Char
Columns 3 = int
Columns 4 = string

Here is my declaration, client is a string variable.

Object[,,,] parametre = new object[4]
{"client",OleDb Type.Char,60,cl ient};

Here is the errors when compiling,

F:\Structure\Pr ojets\VS2003
\PME\WS_PME\Com ponents\DB_data set.cs(122): Cannot
implicitly convert type 'object[]' to 'object[*,*,*,*]'

Now if this was working, on another function I want to
use does value inside the array. How do you access them,
I try a lot of ways but nothing is working so far.

Here is how I try to access it the last time,

public DataSet SqlGenericDataS et(string sqlquery,string
tablename,strin g ConfigConnectio nKey, string fonction,
Object[,,,] aParameter)

for (int a = 0;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);
}

Seam simple to do, but....

Carl,
Nov 15 '05 #4

Hi Carl,

As you can see in the error message, the object array should be 2 dimension.
I changed your code like this:
public virtual DataSet GetFacturesClie ntListeDS(strin g job_id)
{
Object[,] parametre = new object[,]
{{"job_id",OleD bType.SmallInt, 60,job_id}}; //use 2-dimension array
string select = "SELECT * from jobs";
DataSet myDS =
SqlGenericDataS et(select,"clie nt","SQLPME","A UCUNE",parametr e);
return myDS;
}

public DataSet SqlGenericDataS et(string sqlquery,string tablename,strin g
ConfigConnectio nKey, string fonction, Object[,] aParameter)
{
try
{
SqlConnection GenericConnecti on = new
System.Data.Sql Client.SqlConne ction("server=l ocalhost;databa se=pubs;uid=sa; p
wd=");
GenericConnecti on.Open(); //open the connection
SqlCommand GenericCommand = new
System.Data.Sql Client.SqlComma nd(sqlquery,Gen ericConnection) ;

for (int a = 0;a<aParameter. GetLength(0);a+ +)
{

GenericCommand. Parameters.Add( (string)aParame ter.GetValue(a, 0),(SqlDbType)a P
arameter.GetVal ue(a,1),(int)aP arameter.GetVal ue(a,2));
GenericCommand. Parameters[(string)aParame ter.GetValue(a, 0)].Value =
(string)aParame ter.GetValue(a, 3);
}
}
catch(Exception e)
{
Console.WriteLi ne (e.Message );
}
return new DataSet ();
}

I use my default sql server database on my machine and i only create a row
of object array.

I make some small changes to your code:
1. object array changed to 2 dimension
2. add open method to GenericConnecti on
3.in the for loop, change a<=aParameter.G etLength(0) to
a<aParameter.Ge tLength(0)

It works well on my machine.

Hope this helps.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

--------------------
| Content-Class: urn:content-classes:message
| From: "Carl" <ca**@cb-cinc.com>
| Sender: "Carl" <ca**@cb-cinc.com>
| References: <07************ *************** *@phx.gbl>
<bR************ **@cpmsftngxa06 .phx.gbl>
<0d************ *************** *@phx.gbl>
| Subject: RE: Array of obj
| Date: Tue, 26 Aug 2003 09:47:11 -0700
| Lines: 47
| Message-ID: <0f************ *************** *@phx.gbl>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="iso-8859-1"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
| Thread-Index: AcNr8bH5J5D2F7Y VSNiRHck/QpyBcQ==
| Newsgroups: microsoft.publi c.dotnet.langua ges.csharp
| Path: cpmsftngxa06.ph x.gbl
| Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.langua ges.csharp:1795 52
| NNTP-Posting-Host: TK2MSFTNGXA13 10.40.1.165
| X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.csharp
|
| Simplify story.
|
| I want to have one obj array of 4 columns to pass my
| parameters for SQL when required, could have multiple
| rows or just one.
|
| Columns 1 = string
| Columns 2 = OleDbType.Char
| Columns 3 = int
| Columns 4 = string
|
| Here is my declaration, client is a string variable.
|
| Object[,,,] parametre = new object[4]
| {"client",OleDb Type.Char,60,cl ient};
|
| Here is the errors when compiling,
|
| F:\Structure\Pr ojets\VS2003
| \PME\WS_PME\Com ponents\DB_data set.cs(122): Cannot
| implicitly convert type 'object[]' to 'object[*,*,*,*]'
|
| Now if this was working, on another function I want to
| use does value inside the array. How do you access them,
| I try a lot of ways but nothing is working so far.
|
| Here is how I try to access it the last time,
|
| public DataSet SqlGenericDataS et(string sqlquery,string
| tablename,strin g ConfigConnectio nKey, string fonction,
| Object[,,,] aParameter)
|
| for (int a = 0;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);
| }
|
| Seam simple to do, but....
|
| Carl,
|
|
|

Nov 15 '05 #5
Hi Jeffrey,

Thanks for the answers I get a little further, I also
notice another mistake from my part, the OleDbType should
also be SqlDbType for SQL.

Right now I do have the following errors reported,

-------------------------------
An unhandled exception of
type 'System.Web.Ser vices.Protocols .SoapException'
occurred in system.web.serv ices.dll

Additional information:
System.Web.Serv ices.Protocols. SoapException: Server was
unable to process request. --->
System.Data.Sql Client.SqlExcep tion: Line 1: Incorrect
syntax near 'client'.
at System.Data.Sql Client.SqlComma nd.ExecuteReade r
(CommandBehavio r cmdBehavior, RunBehavior runBehavior,
Boolean returnStream)
at System.Data.Sql Client.SqlComma nd.ExecuteReade r
(CommandBehavio r behavior)
at
System.Data.Sql Client.SqlComma nd.System.Data. IDbCommand.Ex
ecuteReader(Com mandBehavior behavior)
at System.Data.Com mon.DbDataAdapt er.FillFromComm and
(Object data, Int32 startRecord, Int32 maxRecords, String
srcTable, IDbCommand command, CommandBehavior behavior)
at System.Data.Com mon.DbDataAdapt er.Fill(DataSet
dataSet, Int32 startRecord, Int32 maxRecords, String
srcTable, IDbCommand command, CommandBehavior behavior)
at System.Data.Com mon.DbDataAdapt er.Fill(DataSet
dataSet, String srcTable)
at WS_PME.DB.SqlGe nericDataSet(St ring sqlquery, String
tablename, String ConfigConnectio nKey, String fonction,
Object[,] aParameter) in f:\structure\pr ojets\vs2003
\pme\ws_pme\com ponents\db_data set.cs:line 101
at WS_PME.DB.GetFa cturesClientLis teDS(String clientID)
in f:\structure\pr ojets\vs2003
\pme\ws_pme\com ponents\db_data set.cs:line 125
at WS_PME.WSPME.Fa cturesClientLis teDS(String client)
in f:\structure\pr ojets\vs2003
\pme\ws_pme\pme .asmx.cs:line 63
--- End of inner exception stack trace ---
------------------------------------

From the function SqlGenericDataS et, in line
GenericDA.Fill( GenericDS, tablename);
-------------------------------------

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]);
GenericConnecti on.Open();
SqlCommand GenericCommand = new
System.Data.Sql Client.SqlComma nd(sqlquery,
GenericConnecti on);

for (int a = 0;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);
}

GenericCommand. CommandTimeout = 30;
SqlDataAdapter GenericDA = new SqlDataAdapter( );
GenericDA.Selec tCommand = GenericCommand;
DataSet GenericDS = new DataSet();
GenericDA.Fill( GenericDS, tablename);
GenericConnecti on.Close();
return GenericDS;
}
-----------------------------------------------

Here is the function calling SqlGenericDataS et.
------------------------------------------------
public virtual DataSet GetFacturesClie ntListeDS
(string clientID)
{
Object[,] parametre = new object
[,] {{"client",SqlD bType.Char,60,c lientID}}; //use 2-
dimension array
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;
------------------------------------------

This error message occurs in the Reference.cs of the web
service, at the following line,
-------------------------------------------
object[] results = this.Invoke
("FacturesClien tListeDS", new object[] {
client});
--------------------------------------------
from the following function,
--------------------------------------------
[System.Web.Serv ices.Protocols. SoapDocumentMet hodAttribute
("http://tempuri.org/FacturesClientL isteDS",
RequestNamespac e="http://tempuri.org/",
ResponseNamespa ce="http://tempuri.org/",
Use=System.Web. Services.Descri ption.SoapBindi ngUse.Literal
,
ParameterStyle= System.Web.Serv ices.Protocols. SoapParameter
Style.Wrapped)]
public System.Data.Dat aSet FacturesClientL isteDS
(string client) {
object[] results = this.Invoke
("FacturesClien tListeDS", new object[] {
client});
return ((System.Data.D ataSet)(results[0]));
}
-------------------------------------------------------

I can see that the variable client contains the good
string value from the debugger.
Again, thanks for your time....

Carl,

Nov 15 '05 #6

Hi Carl,

I think you should post your article in this newsgroup:
microsoft.publi c.dotnet.framew ork.aspnet
In there, our engineer will help you indeep.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

--------------------
| Content-Class: urn:content-classes:message
| From: "Carl" <Ca**@cb-cinc.com>
| Sender: "Carl" <Ca**@cb-cinc.com>
| References: <07************ *************** *@phx.gbl>
<bR************ **@cpmsftngxa06 .phx.gbl>
<0d************ *************** *@phx.gbl>
<0f************ *************** *@phx.gbl>
<oE************ **@cpmsftngxa06 .phx.gbl>
| Subject: RE: Array of obj
| Date: Wed, 27 Aug 2003 09:14:53 -0700
| Lines: 134
| Message-ID: <09************ *************** *@phx.gbl>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="iso-8859-1"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
| Thread-Index: AcNstlk5Cc/ZX/tjRSy8zlBKCXixm Q==
| Newsgroups: microsoft.publi c.dotnet.langua ges.csharp
| Path: cpmsftngxa06.ph x.gbl
| Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.langua ges.csharp:1798 90
| NNTP-Posting-Host: TK2MSFTNGXA08 10.40.1.160
| X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.csharp
|
| Hi Jeffrey,
|
| Thanks for the answers I get a little further, I also
| notice another mistake from my part, the OleDbType should
| also be SqlDbType for SQL.
|
| Right now I do have the following errors reported,
|
| -------------------------------
| An unhandled exception of
| type 'System.Web.Ser vices.Protocols .SoapException'
| occurred in system.web.serv ices.dll
|
| Additional information:
| System.Web.Serv ices.Protocols. SoapException: Server was
| unable to process request. --->
| System.Data.Sql Client.SqlExcep tion: Line 1: Incorrect
| syntax near 'client'.
| at System.Data.Sql Client.SqlComma nd.ExecuteReade r
| (CommandBehavio r cmdBehavior, RunBehavior runBehavior,
| Boolean returnStream)
| at System.Data.Sql Client.SqlComma nd.ExecuteReade r
| (CommandBehavio r behavior)
| at
| System.Data.Sql Client.SqlComma nd.System.Data. IDbCommand.Ex
| ecuteReader(Com mandBehavior behavior)
| at System.Data.Com mon.DbDataAdapt er.FillFromComm and
| (Object data, Int32 startRecord, Int32 maxRecords, String
| srcTable, IDbCommand command, CommandBehavior behavior)
| at System.Data.Com mon.DbDataAdapt er.Fill(DataSet
| dataSet, Int32 startRecord, Int32 maxRecords, String
| srcTable, IDbCommand command, CommandBehavior behavior)
| at System.Data.Com mon.DbDataAdapt er.Fill(DataSet
| dataSet, String srcTable)
| at WS_PME.DB.SqlGe nericDataSet(St ring sqlquery, String
| tablename, String ConfigConnectio nKey, String fonction,
| Object[,] aParameter) in f:\structure\pr ojets\vs2003
| \pme\ws_pme\com ponents\db_data set.cs:line 101
| at WS_PME.DB.GetFa cturesClientLis teDS(String clientID)
| in f:\structure\pr ojets\vs2003
| \pme\ws_pme\com ponents\db_data set.cs:line 125
| at WS_PME.WSPME.Fa cturesClientLis teDS(String client)
| in f:\structure\pr ojets\vs2003
| \pme\ws_pme\pme .asmx.cs:line 63
| --- End of inner exception stack trace ---
| ------------------------------------
|
| From the function SqlGenericDataS et, in line
| GenericDA.Fill( GenericDS, tablename);
| -------------------------------------
|
| 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]);
| GenericConnecti on.Open();
| SqlCommand GenericCommand = new
| System.Data.Sql Client.SqlComma nd(sqlquery,
| GenericConnecti on);
|
| for (int a = 0;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);
| }
|
| GenericCommand. CommandTimeout = 30;
| SqlDataAdapter GenericDA = new SqlDataAdapter( );
| GenericDA.Selec tCommand = GenericCommand;
| DataSet GenericDS = new DataSet();
| GenericDA.Fill( GenericDS, tablename);
| GenericConnecti on.Close();
| return GenericDS;
| }
| -----------------------------------------------
|
| Here is the function calling SqlGenericDataS et.
| ------------------------------------------------
| public virtual DataSet GetFacturesClie ntListeDS
| (string clientID)
| {
| Object[,] parametre = new object
| [,] {{"client",SqlD bType.Char,60,c lientID}}; //use 2-
| dimension array
| 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;
| ------------------------------------------
|
| This error message occurs in the Reference.cs of the web
| service, at the following line,
| -------------------------------------------
| object[] results = this.Invoke
| ("FacturesClien tListeDS", new object[] {
| client});
| --------------------------------------------
| from the following function,
| --------------------------------------------
| [System.Web.Serv ices.Protocols. SoapDocumentMet hodAttribute
| ("http://tempuri.org/FacturesClientL isteDS",
| RequestNamespac e="http://tempuri.org/",
| ResponseNamespa ce="http://tempuri.org/",
| Use=System.Web. Services.Descri ption.SoapBindi ngUse.Literal
| ,
| ParameterStyle= System.Web.Serv ices.Protocols. SoapParameter
| Style.Wrapped)]
| public System.Data.Dat aSet FacturesClientL isteDS
| (string client) {
| object[] results = this.Invoke
| ("FacturesClien tListeDS", new object[] {
| client});
| return ((System.Data.D ataSet)(results[0]));
| }
| -------------------------------------------------------
|
| I can see that the variable client contains the good
| string value from the debugger.
|
|
| Again, thanks for your time....
|
| Carl,
|
|

Nov 15 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2783
by: Brian | last post by:
I'm diddlying with a script, and found some behavior I don't understand. Take this snippet: for ($i = 0; $i <= count($m); $i++) { array_shift($m); reset($m); }
2
575
by: Stormkid | last post by:
Hi Group I'm trying to figure out a way that I can take two (two dimensional) arrays and avShed and shed, and subtract the matching elements in shed from avShed I've pasted the arrays blow from a print_r cmd any suggestions would be great. Thanks much Todd //avShed array Array ( => Array ( => 1 => 08:00 ) => Array ( => 1 => 08:05 ) => Array ( => 1 => 08:10 ) => Array ( => 1 => 08:15 ) => Array ( => 1 => 08:20 ) => Array...
15
5193
by: lawrence | last post by:
I wanted to test xml_parse_into_struct() so I took the example off of www.php.net and put this code up on a site: <?php $simple = <<<END <item>
8
3482
by: vcardillo | last post by:
Hello all, Okay, I am having some troubles. What I am doing here is dealing with an employee hierarchy that is stored in an array. It looks like this: $employees = array( "user_id" => array( "name", "title", "reports to user id", "start date in the format: mm/dd/yyyy" ) ); How can I display this hierarchy in simple nested <li> tags in the most
12
55571
by: Sam Collett | last post by:
How do I remove an item with a specified value from an array? i.e. array values 1,2,2,5,7,12,15,21 remove 2 from array would return 1,5,7,12,15,21 (12 and 21 are NOT removed, duplicates are also removed) So far I have (val is value, ar is array, returns new array):
8
10232
by: Mike S. Nowostawsky | last post by:
I tried using the "toUpperCase()" property to change the value of an array entity to uppercase BUT it tells me that the property is invalid. It seems that an array is not considered an object when it is assigned a text literal?? HOW can I change the array value to upper case then? What other method exists for arrays? Ex: var GridArrayName1 = new Array(); GridArrayName1 = new Array ('test-value'); GridArrayName1 = GridArrayName1...
58
10181
by: jr | last post by:
Sorry for this very dumb question, but I've clearly got a long way to go! Can someone please help me pass an array into a function. Here's a starting point. void TheMainFunc() { // Body of code... TCHAR myArray; DoStuff(myArray);
104
17009
by: Leszek | last post by:
Hi. Is it possible in javascript to operate on an array without knowing how mamy elements it has? What i want to do is sending an array to a script, and this script should add all values from that array Could you show me a little example how to do this? Thanks.
7
3199
by: Jim Carlock | last post by:
Looking for suggestions on how to handle bad words that might get passed in through $_GET variables. My first thoughts included using str_replace() to strip out such content, but then one ends up looking for characters that wrap around the stripped characters and it ends up as a recursive ordeal that fails to identify a poorly constructed $_GET variable (when someone hand-types the item into the line and makes a simple typing error).
17
7255
by: =?Utf-8?B?U2hhcm9u?= | last post by:
Hi Gurus, I need to transfer a jagged array of byte by reference to unmanaged function, The unmanaged code should changed the values of the array, and when the unmanaged function returns I need to show the array data to the end user. Can I do that? How?
0
9639
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9479
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10311
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10146
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8967
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7492
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6733
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5378
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5509
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.