wonder_gal
Oct 26th 2005, 1:54 am
I was supposed to update some data in database.
So i have coded my page so that it will display the "data to be changed" in textbox form, allowing user to edit the data in textbox at the same time.
Then i provide a submit button such that whenever user clicks the submit button, the data changes will be saved into database.
But now i notice that i cannot even retrieve the textbox value that user has made modifications in. Below is part of my code:
<html>
<body>
<form method="post">
<%
Dim sGroup
Dim sCategory
Dim sRisk
Dim sRemark
Dim dbConnection
Set dbConnection = Server.CreateObject("ADODB.Connection")
dbConnection.ConnectionString="Provider=SQLOLEDB.1;UID=sa;Password=password;Initial Catalog=BMI;Data Source=(LOCAL)"
dbConnection.open
set rs=Server.CreateObject("ADODB.recordset")
rs.Open "SELECT * FROM outMessageENContent WHERE msg_bmi_group = '5'", dbConnection
sCategory = rs("msg_category")
sRisk = rs("msg_risk")
sRemark = rs("msg_remark")
Response.write("Category: <input type='text' name='" & txtCategory & "' size ='30' value='" & sCategory & "'>")
Response.Write("<BR>")
Response.Write("Risk: <input type='text' name='" & txtRisk & "' size ='30' value='" & sRisk & "'>")
Response.Write("<BR>")
Response.Write("Remark: <input type='text' name='" & txtRemark & "' size ='120' value='" & sRemark & "'>")
Response.Write("<BR>")
set rs = Nothing
dbConnection.Close()
Set dbConnection = Nothing
%>
<input type="submit" value="Save" action = "<%Call updateMessage()%>"/>
<%
Function updateMessage()
Dim sCategory
Dim sRisk
Dim sRemark
sGroup = 5
sCategory1 = request("txtCategory")
sRisk1 = request("txtRisk")
sRemark1 = request("txtRemark")
response.write "<BR> Category: " &sCategory
response.write "<BR> Risk: " &sRisk
response.write "<BR> Remark: " &sRemark
response.end
End Function
%>
</form>
</body>
</html>
I cannot print out the new sCategory, sRisk and sRemark at all. Can someone pls help? Thanks alot.
So i have coded my page so that it will display the "data to be changed" in textbox form, allowing user to edit the data in textbox at the same time.
Then i provide a submit button such that whenever user clicks the submit button, the data changes will be saved into database.
But now i notice that i cannot even retrieve the textbox value that user has made modifications in. Below is part of my code:
<html>
<body>
<form method="post">
<%
Dim sGroup
Dim sCategory
Dim sRisk
Dim sRemark
Dim dbConnection
Set dbConnection = Server.CreateObject("ADODB.Connection")
dbConnection.ConnectionString="Provider=SQLOLEDB.1;UID=sa;Password=password;Initial Catalog=BMI;Data Source=(LOCAL)"
dbConnection.open
set rs=Server.CreateObject("ADODB.recordset")
rs.Open "SELECT * FROM outMessageENContent WHERE msg_bmi_group = '5'", dbConnection
sCategory = rs("msg_category")
sRisk = rs("msg_risk")
sRemark = rs("msg_remark")
Response.write("Category: <input type='text' name='" & txtCategory & "' size ='30' value='" & sCategory & "'>")
Response.Write("<BR>")
Response.Write("Risk: <input type='text' name='" & txtRisk & "' size ='30' value='" & sRisk & "'>")
Response.Write("<BR>")
Response.Write("Remark: <input type='text' name='" & txtRemark & "' size ='120' value='" & sRemark & "'>")
Response.Write("<BR>")
set rs = Nothing
dbConnection.Close()
Set dbConnection = Nothing
%>
<input type="submit" value="Save" action = "<%Call updateMessage()%>"/>
<%
Function updateMessage()
Dim sCategory
Dim sRisk
Dim sRemark
sGroup = 5
sCategory1 = request("txtCategory")
sRisk1 = request("txtRisk")
sRemark1 = request("txtRemark")
response.write "<BR> Category: " &sCategory
response.write "<BR> Risk: " &sRisk
response.write "<BR> Remark: " &sRemark
response.end
End Function
%>
</form>
</body>
</html>
I cannot print out the new sCategory, sRisk and sRemark at all. Can someone pls help? Thanks alot.