Hello Everyone
i have attended the lot of interview and cleared the telephonic round in all the companies but when i am attending the machine test rounds maximum companies are told that you code is very basic level and your code is not like 2+ exp ,but i have complete the task always what they given, in my organization i am only the developer, i dont have existing project in my concern . actually i dont know how to write the code in procedural way for asp.net with C#, is there any format for upgrade my coding ,or is there any links to refer
this may be help not only for me,this may help many peoples so is there any way to write code typically please let me know
here is my coding
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
Session.Clear();
Session.Abandon();
}
}
protected void submit_Click(object sender, EventArgs e)
{
username = Request.Form["username"].ToString();
password = Request.Form["password"].ToString();
if (connection.State == ConnectionState.Closed)
{
connection.Open();
}
try
{
using (command = new SqlCommand(getsqlstring(), connection))
{
reader = command.ExecuteReader();
while (reader.Read())
{
if (username == reader["uorgid"].ToString() && password == reader["password"].ToString())
{
flag = true;
Session["username"] = username.ToString();
Response.Redirect("~/account/home.aspx",false);
}
}
if (flag == false)
{
ScriptManager.RegisterStartupScript(this, GetType(), "alert", "alert('Username / Password Not Match');", true);
}
}
}
catch (ThreadAbortException)
{
throw;
}
finally
{
connection.Close();
command = null;
}
}
public string getsqlstring()
{
sqlstring ="select distinct ud.uorgid,ud.password,us.compcode from user_details ud,user_security us where ud.uorgid=us.userid";
return sqlstring;
}
where i need to improve in this coding