View Feed
group-icon
Coffee Room
Discuss anything here - everything that you wish to discuss with fellow engineers.
12940 Members
Join this group to post and comment.
prabhat kumar
prabhat kumar • Jan 18, 2010

problem on asp.net

hi everyone,presently i m working in asp.net.i want to retrive data like move
first last add jst like in a form,i have already done gridview list view and form view,if here anybody have done this type of coding then say me is it possible?
if yes then how?
funmonster
funmonster • Jan 21, 2010
prabhat kumar
hi everyone,presently i m working in asp.net.i want to retrive data like move
first last add jst like in a form,i have already done gridview list view and form view,if here anybody have done this type of coding then say me is it possible?
if yes then how?
Dude! I'm familiar with ASP.NET, but I didn't understand what you say. If you can elaborate I may help you.
funmonster
funmonster • Jan 27, 2010
Hurst
When I write code in ASP.NET to access the database...what can I do to avoid thisproblem. to the database server else there is a problem with username and password if the connection.
Make sure the database connection is open till you your query is completely executed, As in the following example:

public partial class Login : System.Web.UI.Page
{
SqlConnection con = new SqlConnection(@"Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\.mdf;Integrated Security=True;User Instance=True");

protected void Button1_Click(object sender, EventArgs e)
{
String qry = "select username,password from registration where username=@username and password=@password";
SqlCommand cmd = new SqlCommand(qry, con);
cmd.Parameters.Add("@username", SqlDbType.VarChar, 40).Value = UserName.Text;
cmd.Parameters.Add("@password", SqlDbType.VarChar, 40).Value = Password.Text;
con.Open();
SqlDataReader dr;
dr = cmd.ExecuteReader();
if (dr.Read())
{
Session["uname"] = UserName.Text; //UserName is the ID of the text box field
Response.Redirect("SuccessfulLogin.aspx"); //Direct the control to user profile
}
else
{
Response.Redirect("Loginfailure.aspx"); //Direct the control to login failure page
}
con.Close();
}
}
prabhat kumar
prabhat kumar • Jan 29, 2010
thanks every one i got my solution...
funmonster
funmonster • Jan 30, 2010
prabhat kumar
thanks every one i got my solution...
Please choose best solution or post it so that it may help some one in future..

Share this content on your social channels -