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
Sousa Pambo
NA
92
24k
Read txt array on c#
Mar 1 2014 3:29 PM
Hi fellows, I need your help on this I have a .....
"Index was out of range. Must be non-negative and less than the size of the collection.\r\nParameter name: index"}
..... Error
public ArrayList lineAccess=new ArrayList();
public void configTxt(string ficheiro)
{
StreamReader conjLines;
string lines;
try
{
conjLines = new StreamReader(ficheiro);
lines = conjLines.ReadLine();
while (lines != null)
{
lineAccess.Add(lines);
lines = conjLines.ReadLine();
}
conjLines.Close();
}
catch (Exception erro)
{
throw erro;
}
}
-----------------------------------------------------------------------------------------------
this is my connection method, and I get the server name at some txt file
public string conectaSql(int i)
{
//string connectionString = Properties.Settings.Default.ConnectionString;
string dv = "";
try
{
string mysql = "select configura from conStringTbl where id= '" + i + "'";
using (SqlConnection myconn = new SqlConnection("Persist Security Info=False;Server=" + lineAccess[0] +"; DataBase=dbconString; user=ka; password =newbegining"))
{
myconn.Open();
using (SqlCommand comand = new SqlCommand(mysql, myconn))
{
SqlDataReader dtreader = comand.ExecuteReader();
if (dtreader.Read())
{
dv = dtreader[0].ToString();
}
return dv;
}
}
}
catch (Exception erro)
{
throw erro;
}
}
______________________________________________
on form login load I get the parameter
private void frmLogin_Load(object sender, EventArgs e)
{
CG.configTxt(@"c:\program Files\a.txt");
}
Thanks!!!!!
Reply
Answers (
10
)
TextBox Search using my Storedprocedure Table
when i recieve value from weight bridge it is slow down