DataSource Controls :: IndexOutOfRangeException Error / How To Fix It
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
Similar Messages:
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
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
Jun 6, 2010
Error:
Executed as user: MACSTEELUSA.COMsa. ...9.00.3042.00 for 32-bit Copyright (C) Microsoft Corp 1984-2005. All rights reserved. Started: 8:00:17 PM Error: 2010-06-02 20:00:18.56 Code: 0xC0202009 Source: CRM_ORACLE_ARSUMMARY Connection manager "SourceConnectionOLEDB" Description: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80004005. An OLE DB record is available. Source: "Microsoft OLE DB Provider for Oracle" Hresult: 0x80004005 Description: "Oracle client
and networking components were not found. These components are supplied by Oracle Corporation and are part of the Oracle Version 7.3.3 or later client software installation. Provider is unable to function until these components are installed.". End Error Error: 2010-06-02 20:00:18.58 Code: 0xC020801C Source: Data Flow Task Source - Query [1] Description: SSIS Error Code DTS_E_CANNOTACQUIRECONNECTIONFROMCONNECTIONMANAGER. The AcquireCon... The package execution fa... The step failed.
Tasks Taken:Went to this folder checked for tnsnames.ora file but it is in good shape.
C:ORACLEproduct11.2.0client_1
etworkadmin
View 2 Replies
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
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
Apr 15, 2010
im working with visualstudio 2005 and sql server 2005 c#,and i tried to insert an items to the sql but it gave me this error
Application server error '/ WebSite6'.
The INSERT statement conflicted with the FOREIGN KEY constraint "FK_StudentToCourse_Students".The conflict occurred in database "TopseaUser", table "dbo.Students", column 'id'.
The statement has been terminated.Description: The exception is unhandled occurred during the implementation of the current web request. the stack trace for more information about the error and where the source code.
Details exception: System.Data.SqlClient.SqlException: The INSERT statement conflicted with the FOREIGN KEY constraint "FK_StudentToCourse_Students". The conflict occurred in database "TopseaUser", table "dbo.Students", column 'id'.The statement has been terminated.
This error: Line 243: sql_comm.Parameters.AddWithValue ("@ studentId", Convert.ToInt32 (id));
Line 244: sql_comm.Parameters.AddWithValue ("@ CourseId", Convert.ToInt32 (ListBox3.Items [j]. Text.ToString
()));
Line 245: sql_comm.ExecuteNonQuery ();
Line 246: split_listbox2 ();
Line 247: sql_conn.Close ();
Source File: c: Documents and Settings Ronen My Documents Visual Studio 2005 WebSites WebSite6 SiteMembers CourseSignUp.aspx.cs line: 245
this it the code :[Code].... !
View 7 Replies
Mar 24, 2010
I have written some vb code that inserts whatever has been written on my page into an Access database. Only problem is VWD throws up an error saying that the syntax of my SQL statement is wrong. I am 95% sure that this statement is correct because when I saw the statement in Text Visualizer and tried that statement in MYSQL the data went in perfectly.
I have pasted the code below:
strSQL = "INSERT INTO User (UserID, FirstName, LastName, Password) VALUES "
View 27 Replies
Apr 22, 2010
Following is the error I am getting while accessing some of the pages on my website.
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: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
It is trowing an exception and giving the about mentioned error.
View 5 Replies
Feb 28, 2010
i get error 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: TCP Provider, error: 0 - No connection could be made because the target machine actively refused it.)
View 4 Replies
Jun 19, 2010
I have a website which displays news information. It displays the titles at the default (home) page and when click it shows the full story.
I use object datasource to load the news titles.
Now, sometimes the database server lose its connection or changes to the database and it affects the whole website because error is reported at the Application level. I would like the Home page to still show but the section where the news titles usually appears will now show an error message that the database is down (Refer below my part of my code).
How can I achieve that?? I tried to do that at the page_error level but it displays nothing. I don't want to pass the error to application level, I want to handle at datasource load/binding level so that it display this error message at the news section and other home website information can still be shown.
[Code]....
View 1 Replies
May 10, 2010
I used visual studio 2008 and sql server 2005(for database) in my website project. After finishing my project i used publish to web option and got the files into an folder. I have installed .NET framework ,IIS, i have also set the remote connection ,firewall setting etc. But when i run i.e., In the IIS manager when i click browse it gives me the following error. Can anyone pls tell me what went wrong in this. My code works fine when run on visual studio 2008. Server Error in '/EBUSINESS' Application.
View 1 Replies
Jun 23, 2010
I am getting this error on my Web Server
Event code: 3005, An Unhandled exception has occurred, Event ID 1309
Application domain: /LM/W3SVC/1/Root/GLI Survey-1-129217809326257882, Trust Level: full, application Virtual Path /GLI Survey, Application path c:inetpubwwrootGLI SURVEY, Machine name: WEBSVR
Here is my SQL Data source parameter:
<
top: -197px"
asp:Label
ID="Label3"
runat="server"
CssClass="Label"
Style="left: -304px; position: relative;
Text="On a scale of 0-5 how would you rate:"></asp:Label><asp:SqlDataSource
ID="SqlDataSource1"
runat="server"
ConnectionString="Integrated Security=SSPI;Persist Security Info=False;database=GLIPurchasingSales;Data Source=sqlsvr"
VALUES (@Branch, CONVERT(Varchar(12), GetDate(), 1), @fatigue, @Q1, @Q2, @Q3, @Q4, @Q5, @Q6, @Q7, @Name, @Company, @Comments, @Recommend, @ConComments)"
InsertCommand="INSERT INTO PurchasingSales([Branch], dt, fatigue, Q1, Q2, Q3, Q4, Q5, Q6, Q7, Name, Company, comments,
Recommend, ConComments)
ProviderName="System.Data.SqlClient">
<InsertParameters>
<asp:ControlParameter
ControlID="ddlfatigue"
Name="fatigue"
PropertyName="SelectedValue"
/>
<asp:ControlParameter
ControlID="ddlQ1"
Name="Q1"
PropertyName="SelectedValue"
/>
<asp:ControlParameter
ControlID="ddlQ2"
Name="Q2"
PropertyName="SelectedValue"
/>
<asp:ControlParameter
ControlID="ddlQ3"
Name="Q3"
PropertyName="SelectedValue"
/>
<asp:ControlParameter
ControlID="ddlQ4"
Name="Q4"
PropertyName="SelectedValue"
/>
<asp:ControlParameter
ControlID="ddlQ5"
Name="Q5"
PropertyName="SelectedValue"
/>
<asp:ControlParameter
ControlID="ddlQ6"
Name="Q6"
PropertyName="SelectedValue"
/>
<asp:ControlParameter
ControlID="ddlQ7"
Name="Q7"
PropertyName="SelectedValue"
/>
<asp:ControlParameter
ControlID="txtBranch"
Name="Branch"
PropertyName="Text"
/>
<asp:ControlParameter
ControlID="txtName"
Name="Name"
PropertyName="Text"
/>
<asp:ControlParameter
ControlID="txtCompany"
Name="Company"
PropertyName="Text"
/>
<asp:ControlParameter
ControlID="txtComment"
Name="Comments"
PropertyName="Text"
/>
<asp:ControlParameter
ControlID="ddlRecommend"
Name="Recommend"
PropertyName="SelectedValue"
/>
<asp:ControlParameter
ControlID="ddlComments"
Name="ConComments"
PropertyName="SelectedValue"
/>
</InsertParameters>
</asp:SqlDataSource>
This is not occurring for all users. If you need the structure of the database please let me know.
View 1 Replies
Jan 2, 2010
I am getting error messages for the last two lines of the following button click event handler code where I am attempting to create a new record in my Profiles table with 3 column entries:
protected void ButtonSubmit_Click(object sender, EventArgs e)
{
string Callsign = Server.HtmlEncode(Textbox1.Text);
string Password = Server.HtmlEncode(Textbox2.Text);
string Email = Server.HtmlEncode(TextBox3.Text);
DataClassesDataContext db = new DataClassesDataContext();
Profile profile = new Profile();
profile.Callsign = Callsign;
profile.Password = Password;
profile.Email = Email;
db.Profiles.Add(profile);
db.SubmitChanges(profile);
}
The first error message refers to the "Add" statement in the second to last line. It states, 'Syatem.Data.Linq.Table<Profile>' does not contain a definition for 'Add'. The last 2 errors refer to the last line. They state "The best overloaded method match
for 'Syatem.Data.Linq.DataContext.SubmitChanges(Syatem.Data.Linq.ConflictMode)' has some invalid arguments" and "Argument '1': cannot convert from 'profile' to 'Syatem.Data.Linq. ConflictMode'".
View 3 Replies
Mar 29, 2011
Dim connStr As String = " Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=W:PatioOrderApp_DataPatio.mdb"
Dim con As New OleDb.OleDbConnection(connStr)
Dim instr As String = " INSERT INTO tOrders([first_name],[last_name],[order],[comment]) Valuse(?,?,?,?)"
If IsValid Then
Using con
Using cmd As New OleDb.OleDbCommand(instr, con)
cmd.CommandType = CommandType.Text
cmd.Parameters.AddWithValue("first_name", DBNull.Value)
cmd.Parameters.AddWithValue("last_name", DBNull.Value)
cmd.Parameters.AddWithValue("order", DBNull.Value)
cmd.Parameters.AddWithValue("comment", menuDrinks.SelectedItem.ToString)
con.Open()
cmd.ExecuteNonQuery()
End Using
End Using
con.Close()
End If
View 1 Replies
Jan 9, 2010
I suing this code to upload csv file data to sql table.
BULK
INSERT uploadtemp
FROM 'F:ArruniArruniRaj-NathanSchoolcvsparents_with_pupil_adm_nos.csv'
WITH
(
FIELDTERMINATOR = ',',
ROWTERMINATOR = '
'
)
END
After i upload data each and every data inside double quatation like
"Mr J and Mrs P Abbott"
"Abbott"
"Gemma"
"N00390"
"Olivia Abbott"
"N00595"
"T"
How can i upload data without " . And also i want start upload data start from second row. How can i do that? [URL]
View 1 Replies
Feb 9, 2010
I am using the SQLDataReader to execute a Stored Procedure that accepts two parameters (BuildingTID and Department) to return the appropritae Value in my case The Director of the Department. My problem is I get the following error when I run the code that I added below for review. Let me also add that the user is selecting the values that I am using for the stored procedure from 2 DropDownLists. I am getting it when I try to assign the value that is in the Department DropDown
list to the first parameter.
Dim myParm As SqlParameter = getDirectorsCMD.Parameters.Add("@BuildingTID", SqlDbType.Int, 15).Value = (ddlDepartment.SelectedValue)
Also obviously there are more issues with my code than just the error because the datareader records property is false meaning I am not returning a row
View 12 Replies
Apr 27, 2010
[Code]....
Stack Trace:
[Code]....
[code]....
getting Incorrect syntax near error
View 2 Replies
Apr 10, 2010
I created a PageLoad event, so when the page opens it fills all the fields from a DataSource control. However, the problem is that if the DataSource control is empty (the row does not exist yet) it gives me an error. How do I check that if DataSource Control has a row of data or not?
View 5 Replies
Feb 23, 2010
I had a repeater that will be binded using dataset
[Code]....
and on page load I write this code
[Code]....
it worked very well on my machine , after applying it on the server it give the following error
Server Error in '/' Application.
Number must be either non-negative or -1. Parameter name: millisecondsTimeout Description: An unhandled exception occurred during the execution of the current web request. review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ArgumentOutOfRangeException: Number must be either non-negative or -1. Parameter name: millisecondsTimeoutSource Error:
[Code]....
Stack Trace:
[Code]....
View 3 Replies
Jun 3, 2010
I am now using SQL Server 2008 EXPRESS x64 on a PC running WINDOWS 7 ULTIMATE x64 bit.
how to configure ASP.Net Membership Providers because I can't attach a database created after this example :
http://aquesthosting.headtreez.com/doc/29423088-74cd-4d51-b2ee-3cb958f08d1a
(I have created runproviders.sql with my Visual Studio x64 Win64 Command Prompt (2010) )
Still now working...
Every time I run ASP.NET Configuration -> Provider -> Select a single provider for all site management data and TEST for
AspNetSqlProvider
I get the following error every time :
"Could not establish a connection to the database.
If you have not yet created the SQL Server database, exit the Web Site Administration tool, use the aspnet_regsql command-line utility to create and configure the database, and then return to this tool to set the provider."
I can tell you for sure that my new created database is working because i used a web page with a CreateUserWizard1 control and I can create new users.Even I can see the new creted user with ASP.NET Configuration -> Security.
View 2 Replies