Visual Studio Sign Up Form

rookie23

New member
Joined
Nov 27, 2006
Messages
3
Programming Experience
1-3
Hi, can anyone help me with the code for a sign up form. A form where the user enters a username and thier details and it is all added to a database and then next time they visit, they can log in.

Ive found the templates but the code is too tricky for me???
 
Your basically asking for a complete application here, simple though it may be. Many of us here are willing to help with problems and explainations, but generally are not here to write applications for other people.

Get yourself started from these templates you've found or any course materials you may have available and when you run into a 'wall' ask how to get around that specific obsticle. In the end you'll have learned something that can make your next application easier.
 
I`ve tried as you said and i can connect to the database. But when i click the add button to add the users details to a database, it does ot add? If I were to post the code, do you think you could help?
 
Sure thing, thats what we are here for.

Do you get a specific error? Paste the relevant code and we can see if anyone spots anything amiss.
 
my code is

Partial Class _Default
Inherits System.Web.UI.Page
Function InsertUser(ByVal NewUserName As String, ByVal NewPassword As String, ByVal NewConfirmPassword As String, ByVal NewEmail As String, ByVal NewSecurityQuestion As String, ByVal NewSecretAnswer As String) As Integer
Dim connectionString As String = _
"Provider=Microsoft.Jet.OLEDB.4.0; Ole DB Services=-4; " & _
" Data Source=C:\Documents and Settings\Compaq_Owner\Desktop\user.mdb"
Dim dbConnection As System.Data.IDbConnection = New System.Data.OleDb.OleDbConnection(connectionString)
Dim querystring As String = "INSERT INTO [tblUser] (UserName, Password, ConfirmPassword, Email, SecurityQuestion, SecretAnswer) " & _
"values (@UserName, @Password, @ConfirmPassword, @Email, @SecurityQuestion, @SecretAnswer)"
Dim cmd As System.Data.IDbCommand = New System.Data.OleDb.OleDbCommand
cmd.CommandText = querystring
cmd.Connection = dbConnection
Dim dbParam1 As System.Data.IDataParameter = New System.Data.OleDb.OleDbParameter
dbParam1.ParameterName =
"@UserName"
dbParam1.Value = NewUserName
dbParam1.DbType = System.Data.DbType.String
cmd.Parameters.Add(dbParam1)
Dim dbParam2 As System.Data.IDataParameter = New System.Data.OleDb.OleDbParameter
dbParam2.ParameterName =
"@Password"
dbParam2.Value = NewPassword
dbParam2.DbType = System.Data.DbType.String
cmd.Parameters.Add(dbParam2)
Dim dbParam3 As System.Data.IDataParameter = New System.Data.OleDb.OleDbParameter
dbParam3.ParameterName =
"@ConfirmPassword"
dbParam3.Value = NewConfirmPassword
dbParam3.DbType = System.Data.DbType.String
cmd.Parameters.Add(dbParam3)
Dim dbParam4 As System.Data.IDataParameter = New System.Data.OleDb.OleDbParameter
dbParam4.ParameterName =
"@Email"
dbParam4.Value = NewEmail
dbParam4.DbType = System.Data.DbType.String
cmd.Parameters.Add(dbParam4)
Dim dbParam5 As System.Data.IDataParameter = New System.Data.OleDb.OleDbParameter
dbParam5.ParameterName =
"@SecurityQuestion"
dbParam5.Value = NewSecurityQuestion
dbParam5.DbType = System.Data.DbType.String
cmd.Parameters.Add(dbParam5)
Dim dbParam6 As System.Data.IDataParameter = New System.Data.OleDb.OleDbParameter
dbParam6.ParameterName =
"@SecurityAnswer"
dbParam6.Value = NewSecretAnswer
dbParam6.DbType = System.Data.DbType.String
cmd.Parameters.Add(dbParam6)
Dim rowsaffected As Integer = 0
dbConnection.Open()
Try
rowsaffected = cmd.ExecuteNonQuery()
Catch
rowsaffected = -1
Finally
dbConnection.Close()
End Try
Return rowsaffected
End Function
Protected Sub cmdCreate_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmdCreate.Click
Dim returnvalue As Integer
returnvalue = InsertUser(txtUserName.Text, txtPassword.Text, txtConfirmPassword.Text, txtEmail.Text, txtSecurityQuestion.Text, txtSecretAnswer.Text)
If returnvalue >= 1 Then
MsgBox("That User Name is already taken, try another!", MsgBoxStyle.Information)
End If
txtUserName.Text = ""
txtPassword.Text = ""
txtConfirmPassword.Text = ""
txtEmail.Text = ""
txtSecurityQuestion.Text = ""
txtSecretAnswer.Text = ""
GridView1.DataBind()
MsgBox(
"Welcome Self Build", MsgBoxStyle.Information)
End Sub
End
Class

but the user details just do not add to the database!
 
Is there a reason you are hand coding this, and not simply using a formview and SQLDataSource?
 
Back
Top