CrazyEngineers
  • problem on asp.net

    Updated: Oct 25, 2024
    Views: 928
    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?
    0
    Replies
Howdy guest!
Dear guest, you must be logged-in to participate on CrazyEngineers. We would love to have you as a member of our community. Consider creating an account or login.
Replies
  • funmonster

    MemberJan 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.
    Are you sure? This action cannot be undone.
    Cancel
  • funmonster

    MemberJan 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|\<your database name>.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();
    }
    }
    Are you sure? This action cannot be undone.
    Cancel
  • prabhat kumar

    MemberJan 29, 2010

    thanks every one i got my solution...
    Are you sure? This action cannot be undone.
    Cancel
  • funmonster

    MemberJan 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..
    Are you sure? This action cannot be undone.
    Cancel
Home Channels Search Login Register