TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Neha Alam
NA
3
0
index out of range error
Jul 2 2009 10:50 AM
hello,
this is the error i get at line
string
ins =
"insert into assign values('"
+ arrText[0] +
"','"
+ arrText[1]+
"')"
;
//insert command
Index was out of range. Must be non-negative and less than the size of the collection
Any suggetions??? my code is here:-
using
System;
using
System.Collections.Generic;
using
System.ComponentModel;
using
System.Data;
using
System.Drawing;
using
System.Linq;
using
System.Text;
using
System.Windows.Forms;
using
System.IO;
using
System.Collections;
using
System.Data.OleDb;
using
System.Data.OracleClient;
namespace
WindowsFormsApplication1
{
public
partial
class
Form1
:
Form
{
public
Form1()
{
InitializeComponent();
}
private
void
Form1_Load(
object
sender,
EventArgs
e)
{
}
private
void
button1_Click(
object
sender,
EventArgs
e)
{
StreamReader
objReader =
new
StreamReader
(
"c:\\test.txt"
);
string
sLine =
""
;
ArrayList
arrText =
new
ArrayList
();
while
(sLine !=
null
)
{
sLine = objReader.ReadLine();
if
(sLine !=
null
)
arrText.Add(sLine);
}
objReader.Close();
foreach
(
string
sOutput
in
arrText)
richTextBox1.Text = sOutput;
}
private
void
button2_Click(
object
sender,
EventArgs
e)
{
StreamReader
objReader =
new
StreamReader
(
"c:\\test.txt"
);
string
sLine =
""
;
ArrayList
arrText =
new
ArrayList
();
while
(sLine !=
null
)
{
sLine = objReader.ReadLine();
if
(sLine !=
null
)
arrText.Add(sLine);
}
objReader.Close();
OracleConnection
oracleConect =
null
;
string
connectStr =
"Data Source=xe;Persist Security Info=True;User ID=system;Password=kuetcse;Unicode=True"
;
oracleConect =
new
OracleConnection
(connectStr);
oracleConect.Open();
OracleCommand
command = oracleConect.CreateCommand();
command.Connection = oracleConect;
string
ins =
"insert into assign values('"
+ arrText[0] +
"','"
+ arrText[1]+
"')"
;
//insert command
command.CommandText = ins;
command.ExecuteNonQuery();
oracleConect.Close();
}
private
void
richTextBox1_TextChanged(
object
sender,
EventArgs
e)
{
}
}
}
Reply
Answers (
1
)
handle error msg due back button in IE in only one page of my application
What is a Predicate
delegate?