i am doing windows application. adminpc has sql server and i am doing an application for client machine from that i have to acees sqldatabase from adminpc. here is the code that i have used.
string strt201 = "";
SqlConnection con200 = new SqlConnection(" Data Source =servername; Initial Catalog=cyberst ations; Integrated Security=true;" );
con200 .Open();
string strt200 = "select max(uasno) from reports where username='"+tbu sernamec1.Text+ "' and password='"+tbp asswordc1.Text+ "'";
SqlCommand cmd200 = new SqlCommand(strt 200 , con200);
SqlDataReader rdr200 = cmd200.ExecuteR eader();
if(rdr200.HasRo ws)
{
while(rdr200.Re ad())
{
strt201 = Convert.ToStrin g(rdr200[0]);
}
tbusernamec1.Te xt = strt201;
}
rdr200.Close();
con200.Close();
i tried the above code but it shows login failed to user 'servername\gue st'
plz anyone could help me
very urgent
thanks in advance
string strt201 = "";
SqlConnection con200 = new SqlConnection(" Data Source =servername; Initial Catalog=cyberst ations; Integrated Security=true;" );
con200 .Open();
string strt200 = "select max(uasno) from reports where username='"+tbu sernamec1.Text+ "' and password='"+tbp asswordc1.Text+ "'";
SqlCommand cmd200 = new SqlCommand(strt 200 , con200);
SqlDataReader rdr200 = cmd200.ExecuteR eader();
if(rdr200.HasRo ws)
{
while(rdr200.Re ad())
{
strt201 = Convert.ToStrin g(rdr200[0]);
}
tbusernamec1.Te xt = strt201;
}
rdr200.Close();
con200.Close();
i tried the above code but it shows login failed to user 'servername\gue st'
plz anyone could help me
very urgent
thanks in advance
Comment