asp_databases thread: What's wrong with this code ?
Message #1 by "Sylvester" <sylvester@e...> on Tue, 20 Jun 2000 11:50:50
|
|
Please Help !!!
Sub UpdateUser(Conn, pkUserID, userName, emailAddress, mobile, phone,
password)
sql = "UPDATE BUsers SET UserName='"&userName&"',
EmailAddress='"&emailAddress&"', " & _
"MobilePhone='"&mobile&"', PhoneNumber='"&phone&"',
Password='"&password&"' " & _
" WHERE pkUserID=" & pkUserID
' Response.Write("update user SQL = " & sql & "<BR>" & vbNewLine)
Conn.execute(sql)
End Sub
Sub CreateUser(Conn, tradingPartyID, userName, emailAddress, mobile, phone,
password)
sql = "INSERT INTO BUsers(kTradingPartyID, UserName, EMailAddress,
MobilePhone, PhoneNumber, Password) " & _
" VALUES("&tradingPartyID&", '"&userName&"', '"&emailAddress&"',
'"&mobile&"', '"&phone&"', '"&password&"')"
Conn.execute(sql)
End Sub
%>
Message #2 by "Ken Schaefer" <ken.s@a...> on Tue, 20 Jun 2000 22:57:52 +1000
|
|
What is the error you are receiving?
Also Password is probably a reserved word, you may need to enclose it in
], or ' ' depending on the database you are using.
In future, why don't you post the error that you are receiving, as well as
the output of Response.Write(strSQL)? Anyway, the following should work
(this is for Access, need to use [ ]):
strSQL = "UPDATE BUsers "
strSQL = strSQL & "SET Username = '" & userName & "', "
strSQL = strSQL & "EmailAddress = '" & emailAddress & "', "
strSQL = strSQL & "MobilePhone = '" & mobile & "', "
strSQL = strSQL & "PhoneNumber = '" & phone & "', "
strSQL = strSQL & "[Password] = '" & password & ", "
strSQL = strSQL & "WHERE pkUserID=" & pkUserID
objConn.execute(strSQL)
and the same for the other sub
----- Original Message -----
From: "Sylvester"
To: "ASP Databases" <asp_databases@p...>
Sent: Tuesday, June 20, 2000 11:50 AM
Subject: [asp_databases] What's wrong with this code ?
>
>
> Please Help !!!
>
> Sub UpdateUser(Conn, pkUserID, userName, emailAddress, mobile, phone,
> password)
> sql = "UPDATE BUsers SET UserName='"&userName&"',
> EmailAddress='"&emailAddress&"', " & _
> "MobilePhone='"&mobile&"', PhoneNumber='"&phone&"',
> Password='"&password&"' " & _
> " WHERE pkUserID=" & pkUserID
>
> ' Response.Write("update user SQL = " & sql & "<BR>" & vbNewLine)
>
> Conn.execute(sql)
> End Sub
>
>
>
> Sub CreateUser(Conn, tradingPartyID, userName, emailAddress, mobile,
phone,
> password)
> sql = "INSERT INTO BUsers(kTradingPartyID, UserName, EMailAddress,
> MobilePhone, PhoneNumber, Password) " & _
> " VALUES("&tradingPartyID&", '"&userName&"', '"&emailAddress&"',
> '"&mobile&"', '"&phone&"', '"&password&"')"
>
>
> Conn.execute(sql)
> End Sub
> %>
>
|