Length cannot be less than zero. Parameter name: length

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Oracle
Post Reply
R. Santana
Posts: 36
Joined: Tue 18 Jan 2005 20:52
Location: SPAIN

Length cannot be less than zero. Parameter name: length

Post by R. Santana » Tue 18 Jan 2005 20:57

Hello,

I'm receiving this error:

Code: Select all

Server Error in '/' Application.
--------------------------------------------------------------------------------

Length cannot be less than zero. Parameter name: length 
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.ArgumentOutOfRangeException: Length cannot be less than zero. Parameter name: length

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.  

Stack Trace: 


[ArgumentOutOfRangeException: Length cannot be less than zero.
Parameter name: length]
   System.String.Substring(Int32 startIndex, Int32 length) +172
   CoreLab.Oracle.Oci.a(String A_0, String A_1) +99
   a.c.q.l() +546
   a.c.q..ctor(Boolean A_0, Boolean A_1, Boolean A_2) +56
   a.c.d..ctor(i A_0) +325
   a.c.k.a(DbConnectionOptions A_0, Object A_1, DbConnectionBase A_2) +37
   CoreLab.Common.DbConnectionFactory.a(DbConnectionPool A_0, DbConnectionOptions A_1) +37
   CoreLab.Common.DbConnectionPool.a() +44
   CoreLab.Common.DbConnectionPool.GetObject() +343
   CoreLab.Common.DbConnectionFactory.a(DbConnectionBase A_0) +77
   CoreLab.Common.DbConnectionClosed.Open(DbConnectionBase outerConnection) +276
   CoreLab.Common.DbConnectionBase.Open() +34
   CoreLab.Oracle.OracleConnection.Open() +23
   System.Data.Common.DbDataAdapter.QuietOpen(IDbConnection connection, ConnectionState& originalState) +44
   System.Data.Common.DbDataAdapter.FillFromCommand(Object data, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +304
   System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +77
   System.Data.Common.DbDataAdapter.Fill(DataSet dataSet) +38
   mundocat._default.Page_Load(Object sender, EventArgs e) in z:\default.aspx.cs:29
   System.Web.UI.Control.OnLoad(EventArgs e) +67
   System.Web.UI.Control.LoadRecursive() +35
   System.Web.UI.Page.ProcessRequestMain() +750

 


--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.1.4322.2032; ASP.NET Version:1.1.4322.2032 
when I try to open a connection to the database, but the connection is configured perfectly and it works in design time.

Anybody knows what this error means?

My code is as simple as the following:

Code: Select all

		private void Page_Load(object sender, System.EventArgs e)
		{
			if (!Page.IsPostBack)
			{
				con.Open();
			}
		}
The breaking point is [con.Open();] line.

Thanks!
Last edited by R. Santana on Wed 19 Jan 2005 10:49, edited 1 time in total.

Oleg
Devart Team
Posts: 264
Joined: Thu 28 Oct 2004 13:56

Re: Length cannot be less than zero. Parameter name: length

Post by Oleg » Wed 19 Jan 2005 10:27

Please specify your connection string.

R. Santana
Posts: 36
Joined: Tue 18 Jan 2005 20:52
Location: SPAIN

Post by R. Santana » Wed 19 Jan 2005 10:40

I tried with:

Code: Select all

Password=xxxx;User Id=xxxx;Server=xxxxxxx;
and

Code: Select all

User ID=xxxx; Password=xxxx; Data Source=xxxxxxx;
and

Code: Select all

User Id=xxxx;Password=xxxx;Server=lstxxxx_xxserver;Connection Timeout=15;
Is possible that my listener name affect to te connectionstring because it contains the word "server"?

Thanks

Oleg
Devart Team
Posts: 264
Joined: Thu 28 Oct 2004 13:56

Re: Length cannot be less than zero. Parameter name: length

Post by Oleg » Fri 21 Jan 2005 12:13

What is your version of Oracle Client?
What is the version of oci.dll file. This exception can be raised if file oci.dll doesn't have version.

R. Santana
Posts: 36
Joined: Tue 18 Jan 2005 20:52
Location: SPAIN

Post by R. Santana » Fri 21 Jan 2005 12:17

I have Oracle 10g Client installed on my machine. oci version is 10.1.0.2.0

Oleg
Devart Team
Posts: 264
Joined: Thu 28 Oct 2004 13:56

Re: Length cannot be less than zero. Parameter name: length

Post by Oleg » Fri 28 Jan 2005 08:37

Check the value of environment variable PATH. It might include path to BIN
directory at Oracle Client.
Does this directory have end '\? Please send us the value of your PATH variable.

R. Santana
Posts: 36
Joined: Tue 18 Jan 2005 20:52
Location: SPAIN

Post by R. Santana » Thu 10 Feb 2005 19:11

I didn't reveice any solution to this error. Can you help me please?

Oleg
Devart Team
Posts: 264
Joined: Thu 28 Oct 2004 13:56

Post by Oleg » Fri 11 Feb 2005 16:12

Try to test this problem with OraDirect 3.0 beta.

R. Santana
Posts: 36
Joined: Tue 18 Jan 2005 20:52
Location: SPAIN

Post by R. Santana » Fri 11 Feb 2005 17:39

with 3.0 Beta works fine. But I bought 2.50 and it doesn't work with it. What can I do?

Regards

mart

the same error

Post by mart » Tue 01 Mar 2005 04:34

I have the same error, pleased respose, a work aroung.

Thanks

mart

lenght error is a security problem

Post by mart » Fri 04 Mar 2005 05:39

Hi,

This is a security problem, make sure the user id 'aspnet', have the necesary right on the 'c:\oracle\ora*' directory... On my case, I include this user, on the administrator group (local administrator), of my machine....

Good luck

Post Reply