C# - IndexOutofRangeException Occurred?
Oct 12, 2010
I am getting 'indexOutofRangeException occurred' error - 'FixedActual'
SqlDataReader dataReader = null;
SqlCommand Scmd = new SqlCommand("SalesGetRecalcOrderItemCosts", this._connection);
Scmd.CommandType = System.Data.CommandType.StoredProcedure;
[code]...
View 1 Replies
Similar Messages:
Jan 27, 2010
Can anyone tell me why I get this error:
I'm trying to output my query results:
SELECT * FROM sites LEFT JOIN pages ON sites.siteid=pages.siteid LEFT JOIN subpages ON Pages.pageid=subpages.pageid WHERE sites.siteID = 1 ORDER BY sites.siteid ASC
using the code:
[code]....
Source Error:
[Code]....
Line 35: Line 36: While reader.Read()Line 37: mydata &= reader.Item("sitename") & " " & reader.Item("pageid") & " " & reader.Item("pagetitle") & "<br>" & reader.Item("subpages.pageid")Line 38: Line 39:
View 14 Replies
Oct 19, 2010
I'm trying to get data from a CSV file and add it directly into a database using Linq.
I'm using the following code:
[Code]....
The code works if I remove all the but the first property e.g.
[Code]....
But then I get the old "System.IndexOutOfRangeException: Index was outside the bounds of the array." exception when adding more columns.
View 1 Replies
Jan 19, 2011
I am getting this error"System.IndexOutOfRangeException: There is no row at position 0." same code and concept working fine in 2 websites i could not able to solve this,only difference between current implementation and earlier implementation database,previously i used MySql database and now Ms-Excel data.I debugged data set is retreiving Code
Protected Sub chkSelect_CheckedChanged(ByVal sender As Object, ByVal e As
System.EventArgs)
Dim indx As Integer
Dim strExcelConn As String =
[code...]
View 3 Replies
Dec 15, 2010
I have the following web service:
[ScriptService]
public class Handler : WebService {
[WebMethod]
public void method1() {
string json = "{ "success": true }";
System.Web.HttpContext.Current.Response.Write(json);
[code]...
The first method accepts a traditional html form post and response writes a JSON string to the page.The second method accepts a JSON value posted via AJAX and returns a serialized object.Both these methods work fine on their own but when put together in the same web service I get this error when calling method1:
System.IndexOutOfRangeException: Index was outside the bounds of the array.
When I remove the arguments from method2 they work.Can anyone suggest why this is happening?
Edit:The problem spans from the argument type of method2. If I change it to a string or simple data type it works fine.As Joel suggests it's probably because Dictionaries can't be serialized.This doesn't seem to affect my requests sent by ajax and only breaks direct form posts to this handler.Therefore my workaround is to put the form post handlers in a separate file by themselves.Not ideal but works for my application.
View 1 Replies
Feb 9, 2010
I am having a little trouble with an 'IndexOutOfRangeException'. I think it is because when the code tries to get the DateModified col from the database it sometimes contains NULLS (the users haven't always updated the page since they created it).
Here is my code;
s = ("select datemodified, maintainedby, email, hitcount from updates where id = @footid")
Dim x As New SqlCommand(s, c)
x.Parameters.Add("@footid", SqlDbType.Int)
x.Parameters("@footid").Value = footid
c.Open()
Dim r As SqlDataReader = x.ExecuteReader
While r.Read
If r.HasRows Then
datemodified = (r("DateModified"))
maintainedby = (r("maintainedby"))
= (r("email"))
hitcount = (r("hitcount"))
End If
End While
c.Close()
I thought (after a bit of msdn) that adding;
If r.HasRows Then
End If
after adding I am still getting the same old IndexOutOfRangeException
(ps, I have tried datemodified as string / datetime)
View 4 Replies
Jan 27, 2010
I've got a FormView bound to an ObjectDataSource. The FormView/ODS selects and displays my data correctly but when I change the data and try to update,nothing (seemingly) happens.Stepping through the code and digging deeper into the stack trace and output window,I figured out that the following sequence of events happens:
- The ObjectDataSource drills down to System.Web.UI.WebControls.ObjectDataSourceView.BuildDataObject to create the object I specified in the "DataObjectTypeName" property
[code]...
- Here is where the IndexOutOfRangeException happens. Sometimes one or two of the data object's properties will be set, sometimes none. Either way, the exception is thrown and the sequence is stopped (the business object's update is never called).
- The exception is not thrown inside any of the properties' set methods.I'm assuming that the exception is happening when BuildDataObject is using Reflection to find my data object's properties (GetProperty() etc.. ). Since I can't see the source code of BuildDataObject and the debugger won't give me any more information, there is no way for me to see which property (if any) is causing this.I double checked the names and types of all 27 of the data object's properties.
View 1 Replies
Nov 30, 2010
I'm trying to do a master-detail by first search the database when a user click on the search button. Then display the result to a ListView control. After that, if the user click on the hyperlink, it displays the detail on the Formview control. Below are my code:
[Code]....
And here's the part that causes the error:
[Code]....
The error is on this line: string strID = ltvLusHmoob.DataKeyNames[e.Item.DataItemIndex].ToString();
View 9 Replies
Aug 4, 2010
I am getting the following error and .Net master how to solve or getrid from this error
eg: datareader["ColumnName"];-----------------> i am getting error on this line
View 5 Replies
Oct 13, 2010
I'm handling exceptions in the Application_Error() method in Global.asax but ex.Source is not giving me much. I want to know where the error occured i.e. /folderName/pageName.aspx.
Also I use lots of user controls so getting aspx name may not even be enough. Is there a way to get the name of object where the exception occured i.e. class name, user control name, etc.
View 1 Replies
Nov 25, 2010
static string SomeMethodThatMightThrow(string s)
if (s[4] == 'C')
throw new InvalidOperationException();
return @"C:
ewFolder" + s;
static void Main(string[] args)
string[] files = { "fileA.txt", "B.txC", "fileC.txt","fileD.txt" };
[code]...
View 6 Replies
Jan 21, 2011
I want write an module how log all errors in site.
View 5 Replies
Jan 12, 2011
static string SomeMethodThatMightThrow(string s)
{
if (s[4] == 'C')
[code]...
View 3 Replies
Apr 6, 2010
I was developing a project. It was running fine. But suddenly it shows the following error:
Quote:
An error occurred creating the form. See Exception.InnerException for details. The error is: Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))
But in the meantime I have not change a single line of code.
View 5 Replies
Nov 3, 2010
I am reading XML file in the following code
[Code]....
when my xml file is big, I get the following error unexpected end of file while parsing name has occurred. Line 1, position 2034 the xmlData debug showed that not all the xml file is being read
[Code]....
I read that the memory of the string variable is not big enough to handle the xml file, what can I use to be able to read big xml files. my program works for small xml text.
View 1 Replies
Dec 28, 2010
i need to update client on any changes occurred on server.for that i found 2 approach.
1. using ajax which is also known as reverse ajax for this purpose.
2. using COMET.
but i don't know exact difference in both.
my site contains news content and i want that news to be automatically updates when new news is entered by my CMS application. i have got hundreds of concurrent users on my web application.
NOTE: i am using .net framework 2.0 but if its not possible in 2.0 then can also move to 3.5
View 1 Replies
Oct 12, 2010
one of the sites hosted on our server is giving this error in event viewer
Event Type: Warning
Event Source: ASP.NET 2.0.50727.0
Event Category: Web Event
Event ID: 1309
Date: 24/06/2008
Time: 17:28:40
User: N/A
Computer:
Description:
Event code: 3005
Event message: An unhandled exception has occurred.
Event time: 24/06/2008 17:28:40
Event time (UTC): 24/06/2008 16:28:40
Event ID: 7addcd74d55746d3b73bf9905eb3edeb
Event sequence: 17
Event occurrence: 6
Event detail code: 0
Application information:
Application domain: /LM/W3SVC/586182382/Root-1-128587971859459234
Trust level: Full
Application Virtual Path: /
Application Path: C:Inetpubconvex_crm
Machine name:
Process information:
Process ID: 6956
Process name: w3wp.exe
Account name: NT AUTHORITYNETWORK SERVICE
Exception information:
Exception type: InvalidOperationException
Exception message: Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached.
Request information:
Request URL:
Request path: /Default.aspx
User host address: 192.168.23.52
User:
Is authenticated: False
Authentication Type:
Thread account name: NT AUTHORITYNETWORK SERVICE
Thread information:
Thread ID: 1
Thread account name: NT AUTHORITYNETWORK SERVICE
Is impersonating: False
Stack trace: at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
at System.Data.SqlClient.SqlConnection.Open()
at Utils.GetOne(String query) in c:Inetpubconvex_crmApp_CodeUtils.cs:line 24
at Settings.GetSettings(String keyname) in c:Inetpubconvex_crmApp_CodeSettings.cs:line 17
at _Default.Page_Load(Object sender, EventArgs e) in c:Inetpubconvex_crmDefault.aspx.cs:line 19
at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e)
at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e)
at System.Web.UI.Control.OnLoad(EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
Custom event details: For more information, see Help and Support Center at [URL] the site was developed in ASP.NET 2.0 what might be the problem how to resolve it??
View 5 Replies
Mar 5, 2010
I have seen a few posts regarding this issue but not one specific to my problem and I have no ideas as to what I need to do to debug this.I have some combo boxes on an aspx pages, when I select a value from the first one, it fills the second with value and so on with the third and fourth. This works with no problems until I wrap an asp.net UpdatePanel around the combo boxes and try to "ajaxify" the whole process so the page isn't dancing around. The exact error I get is: Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The status code returned from the server was: 404
View 1 Replies
May 5, 2010
I'm logging all errors occuring in my OnException method.
How to find in which controller/action an error occurred?
View 3 Replies
Sep 1, 2010
I have ObjectDataSource and GridView on one of the pages of my asp.net web project.
To initialize ObjectDataSource i use Init event:
protected void ObjectDataSource1_Init(object sender, EventArgs e)
{
ObjectDataSource1.EnablePaging = true;
ObjectDataSource1.TypeName = "CustomerDataSource";
ObjectDataSource1.DataObjectTypeName = "Customer";
ObjectDataSource1.SelectMethod = "GetCustomers";
ObjectDataSource1.UpdateMethod = "Update";
ObjectDataSource1.SelectCountMethod = "GetCustomersCount";
ObjectDataSource1.MaximumRowsParameterName = "maximumRows";
ObjectDataSource1.StartRowIndexParameterName = "startRowIndex";
}
Somewhere in DAL:
public static List<Customer> GetCustomers(int maximumRows, int startRowIndex)
{
try {
... some select to database here...
}
catch (Exception ex)
{
Utils.LogError(ex);
throw ex;
}
}
Now let's imagine that GetCustomers for some reason throws an exception. How could i catch this exception and handle it? I know i can use Application_Error, but i would like to catch this exception somehow on my page and show some friendly message to the user.
View 1 Replies
May 12, 2010
When I enter the full hard disk path as a parameter of the method Image.Save, I get no error and the file is being saved on the desired location. But I want the image saved inside Web project folder of the application so I use this code:
myImage.Save(Server.MapPath("SomeApp.Web/report.png"), System.Drawing.Imaging.ImageFormat.Png);
and then I get the following error. Logically, this path is OK, so why error?! PS. myImage is of type System.Drawing.Image.
View 2 Replies
Jul 15, 2010
guys, i have an application that uses Active Directory Authentication and deployed the application several days ago without any error. Today, I got this error.please refer to the image. I find it weird because I didn't change any code to my webconfig file since i deployed the application to the server. I've notice that it's working if it's [URL](by opening the source file in server and debug it) however when i try to access the application through [URL] I'm getting this error. I'm using 2.0 framework And here's my web.config
[Code]....
View 1 Replies
Sep 8, 2010
Put together a little ASP.NET Web Application project in VS 2010. It includes a connection string to a remote SQL server, which is stored in Web.config. Everything works fine on my workstation, but when I test it on the web server I get this error:onfiguration Error Description:An error occurred during the processing of a configuration file required to service this request. review the specific error details below and modify your configuration file appropriately.
[code]...
View 3 Replies
Oct 13, 2010
Everything was working fine yesterday afternoon before going home.. shut down with no issues and this morning when i try to open SQL i get error message with the following, im on a deadline with this project and cant afford to lose what i have setup already. Is there anything i can do to correct whatever issues there may be?
TITLE: Connect to Server
------------------------------
Cannot connect to local.
------------------------------
ADDITIONAL INFORMATION:
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified) (Microsoft SQL Server, Error: -1)
View 2 Replies
Oct 18, 2010
I get the following messages for whatever action I do with TabContainer and TabPanel controls.what should I do to get rid of these messages.A first chance exception of type 'System.Threading.ThreadAbortException' occurred in mscorlib.dll
An exception of type 'System.Threading.ThreadAbortException' occurred in.mscorlib.dll but was not handled in user code.
View 1 Replies