.NET Framework Bookmark and Share   
 index > 64-Bit .NET Framework Development > Memory Error in vs2008
 

Memory Error in vs2008

I m using VS2008 with oledb provider. Here is the sample code:

Int32 Counter, LenderCount;

string ReturnVal = "";

string[] Lenders;

char[] arrParam = new char[] { ',' };

string Result = SaveLenBegin(); //One procedure is executed here

if (Result.Trim() != "-1")

{

OleDbConnection con = this.MyConnection();

OleDbCommand cmd = con.CreateCommand();

OleDbParameter[] LenderExtrapolate = new OleDbParameter[4];

cmd.CommandType =

CommandType.StoredProcedure;

cmd.CommandTimeout =

Convert.ToInt32(HttpContext.Current.Application["DB.CommandTimeOut"], CultureInfo.InvariantCulture);

cmd.CommandText =

"procNameHere";

Lenders = LenderList.Split(arrParam);

for (LenderCount = 0; LenderCount < Lenders.Length; LenderCount++)

{

LenderExtrapolate[0] =

new OleDbParameter("@mp_id", Lenders[LenderCount]);

LenderExtrapolate[0].Size = 5;

LenderExtrapolate[0].OleDbType =

OleDbType.Integer;

LenderExtrapolate[0].Direction =

ParameterDirection.Input;

LenderExtrapolate[1] =

new OleDbParameter("@created_by", userID.Trim());

LenderExtrapolate[1].OleDbType =

OleDbType.VarChar;

LenderExtrapolate[1].Size = 20;

LenderExtrapolate[1].Direction =

ParameterDirection.Input;

LenderExtrapolate[2] =

new OleDbParameter("@result", 0);

LenderExtrapolate[2].Size = 5;

LenderExtrapolate[2].OleDbType =

OleDbType.Integer;

LenderExtrapolate[2].Direction =

ParameterDirection.Output;

LenderExtrapolate[3] =

new OleDbParameter("@message", "");

LenderExtrapolate[3].OleDbType =

OleDbType.VarChar;

LenderExtrapolate[3].Size = 35;

LenderExtrapolate[3].Direction =

ParameterDirection.Output;

for (Counter = 0; Counter < LenderExtrapolate.Length; Counter++)

{

cmd.Parameters.Add(LenderExtrapolate[Counter]);

}

cmd.ExecuteNonQuery(); //Error is @ this line

ReturnVal =

Convert.ToString(cmd.Parameters[2].Value, CultureInfo.InvariantCulture);

cmd.Parameters.Clear();

}

}

return ReturnVal;

}

Error is: "Attempted to read or write protected memory. This is often an indication that other memory is corrupt."
For loop is executed fine at first time. Error occures from second round.
Plese help. it is very urgent

MeghaS
Post your connection string.

Hans Passant.
nobugz

Multibyteasunicode = 1;Server=ServerName;Port=1501;PROVIDER=ASEOLEDB;User ID=User1;Password=Pwd1;Initial Catalog=Catalog1;Select Method = Cursor;Workstation id =WS001;

MeghaS
You'll have to post to a Sybase support forum to get help.
Hans Passant.
nobugz

You can use google to search for other answers

Custom Search

More Threads

• visual studio 2005 vista 64bit build configuration manager setting and application speed
• BadImageFormatException in Net 2.0/32-bit app under Vista/64-bit
• Redirection issues with 32 bit application
• 64 bit Application Compilation on 32 bit OS
• Processors
• ODBCConnection on 64-bit
• how to do .net performance measures
• Help running vb.net application in 64 bit OS
• .NET project could not run on XP 64 bit machine
• Designed for Windows XP 64 ?