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)
{
}
}
}