speedy05
08-03-2005, 02:03 AM
hi
i have a registration page which works fine so far-im using vb.net and connecting to a mysql database wth odbc.
im just wondering how can i stop someone registering with the same email address more than once.I have a couple of books on asp.net but they only refer how to do this with a stored procedure which my version of mysql doesnt support
Really appreciate any help on this..im a beginner and i cant figure out how to do it without a stored procedure...can it be done without?
heres the part of the code i have so far which inserts the users data:
Sub Register_Click(s As Object, e As EventArgs)
Cmd = New OdbcCommand ("INSERT INTO User (firstname, lastname, address1,address2,email,telno,pwd) VALUES (?, ?, ?,?,?,?,?)" ,conn)
Cmd.Parameters.Add("@firstname",odbctype.varchar,10).value = txtfirstname.text
Cmd.Parameters.Add("@lastname",odbctype.varchar,10).value = txtlastname.text
Cmd.Parameters.Add("@addr1",odbctype.varchar,20).value = txtaddress1.text
Cmd.Parameters.Add("@addr2",odbctype.varchar,20).value = txtaddress2.text
Cmd.Parameters.Add("@email",odbctype.varchar,20).value = txtemail.text
Cmd.Parameters.Add("@telno",odbctype.varchar,20).value = txttelno.text
Cmd.Parameters.Add("@pwd",odbctype.varchar,20).value = txtpassword.text
conn.open()
Cmd.ExecuteNonQuery()
Conn.Close()
Response.Redirect("login.aspx")
End Sub
appreciate all suggestions :)
thanks
i have a registration page which works fine so far-im using vb.net and connecting to a mysql database wth odbc.
im just wondering how can i stop someone registering with the same email address more than once.I have a couple of books on asp.net but they only refer how to do this with a stored procedure which my version of mysql doesnt support
Really appreciate any help on this..im a beginner and i cant figure out how to do it without a stored procedure...can it be done without?
heres the part of the code i have so far which inserts the users data:
Sub Register_Click(s As Object, e As EventArgs)
Cmd = New OdbcCommand ("INSERT INTO User (firstname, lastname, address1,address2,email,telno,pwd) VALUES (?, ?, ?,?,?,?,?)" ,conn)
Cmd.Parameters.Add("@firstname",odbctype.varchar,10).value = txtfirstname.text
Cmd.Parameters.Add("@lastname",odbctype.varchar,10).value = txtlastname.text
Cmd.Parameters.Add("@addr1",odbctype.varchar,20).value = txtaddress1.text
Cmd.Parameters.Add("@addr2",odbctype.varchar,20).value = txtaddress2.text
Cmd.Parameters.Add("@email",odbctype.varchar,20).value = txtemail.text
Cmd.Parameters.Add("@telno",odbctype.varchar,20).value = txttelno.text
Cmd.Parameters.Add("@pwd",odbctype.varchar,20).value = txtpassword.text
conn.open()
Cmd.ExecuteNonQuery()
Conn.Close()
Response.Redirect("login.aspx")
End Sub
appreciate all suggestions :)
thanks