I cant set validation for existing Username when submit a registration form

I cant set validation for existing Username when submit a registration form

am 24.04.2006 14:51:44 von Chris Wu

<%

strODBC = "DSN=mysql_dsn; UID=root; PWD=;"

dim nama, syarikat, alamat1, alamat2
dim zip, negeri, negera, telefonP
dim telefonB, fax, emel, id
dim katalaluan1, sta, soalan, jawapan

nama = request.form("dNa")
syarikat = request.form("dSy")
alamat1 = request.form("dA1")
alamat2 = request.form("dA2")
zip = request.form("dZip")
bandar = request.form("dBand")
negeri = request.form("dNe")
negara = request.form("dNeg")
telefonP = request.form("dTP")
telefonB = request.form("dTB")
fax = request.form("dF")
emel = request.form("dE")
id = request.form("dNId")
katalaluan1 = request.form("dKat1")
sta = request.form("status")
soalan = request.form("dSoa")
jawapan = request.form("dJa")

Dim Objrs
Set Objrs = Server.CreateObject("ADODB.Recordset")

Dim Strsql
Strsql = "SELECT * FROM pendaftaran WHERE dNId = '" & id & "'"
Objrs.Open Strsql, strODBC, 1, 3

If Objrs.eof then
Set Objrs = Nothing
Set strODBC = Nothing
Response.redirect"Pendaftaran.asp?Message=!! Minta Maaf...Nama Id
Anda Telah Didaftar Oleh Ahli Lain!!"

Else

Objrs.AddNew
Objrs("dNa") = nama
Objrs("dSy") = syarikat
Objrs("dA1") = alamat1
Objrs("dA2") = alamat2
Objrs("dZip") = zip
Objrs("dBand") = bandar
Objrs("dNe") = negeri
Objrs("dNeg") = negara
Objrs("dTP") = telefonP
Objrs("dTB") = telefonB
Objrs("dF") = fax
Objrs("dE") = emel
Objrs("dNId") = id
Objrs("dKat1") = katalaluan1
Objrs("status") = stat
Objrs("dSoa") = soalan
Objrs("dJa") = jawapan
Objrs.Update
' ::::: Removing Recordset & Connection Object
Set Objrs = Nothing
Set strODBC = Nothing
Response.redirect"MainPage.asp?Message=Anda telah berjaya daftar diri
sebagai ahli"

End If

%>

*** Sent via Developersdex http://www.developersdex.com ***

Re: I cant set validation for existing Username when submit a registration form

am 24.04.2006 15:07:01 von Mike Brind

Chris Wu wrote:
> <%
>
> strODBC = "DSN=mysql_dsn; UID=root; PWD=;"

Don't use system DSNs. See http://www.aspfaq.com/show.asp?id=2126



>
> Dim Strsql
> Strsql = "SELECT * FROM pendaftaran WHERE dNId = '" & id & "'"
> Objrs.Open Strsql, strODBC, 1, 3
>


Don't Select *. You only need to select one field to serve your
purpose here.


> If Objrs.eof then
> Set Objrs = Nothing
> Set strODBC = Nothing
> Response.redirect"Pendaftaran.asp?Message=!! Minta Maaf...Nama Id
> Anda Telah Didaftar Oleh Ahli Lain!!"
>
> Else
>
> Objrs.AddNew

Don't use AddNew. See http://www.aspfaq.com/show.asp?id=2191


You haven't created or opened a connection object. You're the second
one today. Are you from the same class as this person?

http://groups.google.co.uk/group/microsoft.public.inetserver .asp.db/browse_frm/thread/40325302a02c5d7a/1ac9018fe7ce6163? hl=en#1ac9018fe7ce6163

--
Mike Brind

Re: I cant set validation for existing Username when submit a registration form

am 25.04.2006 06:31:33 von Chris Wu

Good morning,sir

Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[TCX][MyODBC]Access denied for user: 'kokseng@kokseng' (Using password:
YES)

I still error even i already correct all my wrong syntax just now.
How?pls give some tips!!!!Thanks you

*** Sent via Developersdex http://www.developersdex.com ***

Re: I cant set validation for existing Username when submit a registration form

am 25.04.2006 09:24:24 von Mike Brind

Chris Wu wrote:
> Good morning,sir
>
> Error Type:
> Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
> [TCX][MyODBC]Access denied for user: 'kokseng@kokseng' (Using password:
> YES)
>
> I still error even i already correct all my wrong syntax just now.
> How?pls give some tips!!!!Thanks you
>
> *** Sent via Developersdex http://www.developersdex.com ***

What database are you using? MySQL?

--
Mike Brind

Re: I cant set validation for existing Username when submit a registration form

am 25.04.2006 09:59:00 von Chris Wu

Thanks for reply my question.I use MySQL database but i already fix my
problem.So sorry about inform you late anyway thank you very much..But
now i have another problem which i just posted it up..Hope you can help
me to fix that problem and finish my project and also increase my
knowlwdge in ASP,web programming language..Thank you again!!!

*** Sent via Developersdex http://www.developersdex.com ***