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!!!!!