hello everyone;
how we can create user account in c#. the fields of user account is given below.
1) user id
2) name
3)password
4)confirm password
5)email
6) security question
7) security answer
in the last , i placed create user button . i am using asp.net and c#
regards
sumaira
Loading

Satyapriya NayakPosted Aug 20, 2011, 1:51 PM
If this post helps you mark it as answer
Thanks
sumaira manzoor hussain khanPosted Aug 20, 2011, 1:01 PM
thanks very much for show your interest in my problem
regards
sumaira
Satyapriya NayakPosted Aug 19, 2011, 6:56 AM
Here is your desired code and run the attachments.
Default.aspx code
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
Default.aspx.cs code
using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
public partial class _Default : System.Web.UI.Page
{
string connStr = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
SqlCommand com;
DataSet ds;
string str;
protected void Page_Load(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection(connStr);
con.Open();
str = "select * from secret";
com = new SqlCommand(str, con);
SqlDataReader reader = com.ExecuteReader();
while (reader.Read())
{
ddlsecurityquestion.Items.Add(reader["secretqno"].ToString());
}
reader.Close();
con.Close();
}
protected void b1_Click(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection(connStr);
con.Open();
str = "insert into useraccount(userid,name,password,confirmpassword,email,securityquestion,securityanswer) values('" + txtid.Text + "','" + txtname.Text + "','" + txtpassword.Text + "','" + txtconfirmpassword.Text + "','" + txtemail.Text + "','" + ddlsecurityquestion.SelectedItem.Text + "','" + txtsecurityanswer.Text + "')";
com = new SqlCommand(str, con);
com.ExecuteNonQuery();
con.Close();
Response.Redirect("success.aspx");
}
}
Thanks
If this post helps you mark it as answer
Jaganathan BantheswaranPosted Aug 19, 2011, 4:20 AM
Read this.