kiran kumar

kiran kumar

  • NA
  • 1k
  • 270.3k

problem with createuser wizard

Dec 15 2009 2:58 AM
protected void CreateUserWizard1_CreatedUser(object sender, EventArgs e) { SqlConnection con = new SqlConnection("Data Source=KIRAN\\SQLEXPRESS;Initial Catalog=kiran;Integrated Security=True"); con.Open(); string querystring; querystring = "insert into reg(username,password,email,securityquestion,securityanswer)values('@username','@password','@email','@securityquestion','@securityanswer')"; SqlCommand cmd = new SqlCommand(querystring, con); SqlParameter uname = new SqlParameter("@username", SqlDbType.NVarChar, 50); uname = CreateUserWizard1.UserName; cmd.Parameters.Add(uname); SqlParameter pass = new SqlParameter("@password", SqlDbType.NVarChar, 50); pass = CreateUserWizard1.Password; cmd.Parameters.Add(pass); SqlParameter ema = new SqlParameter("@email", SqlDbType.NVarChar, 50); ema = CreateUserWizard1.Email; cmd.Parameters.Add(ema); SqlParameter secques = new SqlParameter("securityanswer", SqlDbType.NVarChar, 50); secques = CreateUserWizard1.Question; cmd.Parameters.Add(secques); SqlParameter secans = new SqlParameter("securityanswer", SqlDbType.NVarChar, 50); secans = CreateUserWizard1.Answer; cmd.Parameters.Add(secans); cmd.ExecuteNonQuery(); con.Close(); Cannot implicitly convert type 'string' to 'System.Data.SqlClient.SqlParameter'

Answers (1)