我有一个从SQL数据库中提取数据的脚本,将数据存储到变量中。现在我需要获取这些数据并将它们放入HTML表单(文本框?)以便他们编辑它们,然后我将运行UPDATE查询进行更新。
' Create a DataReader and execute the command
objDR = objCmd.ExecuteReader
While objDR.Read()
sale_id = objDR(0)
cust_id = objDR(1)
agent_id = objDR(2)
saledate = objDR(3)
actualamount = objDR(4)
contractid = objDR(5)
homeid = objDR(6)
End While
strSuccess.Text = "<h2>Sale ID #" & agent_id & " and " & actualamount & "</h2>"
strSuccess.Visible = "True"
' Close all objects
objDR.Close
objCmd.Dispose
objDBConn.Close
End Sub
</script>
<title>CUSTOMERS table</title>
</head>
<body>
<center>
<h2>Oracle sales table contents</h2>
<asp:label id="strSuccess" runat="server" />
Sale Amount: <input TYPE="text" NAME="saledate">
</center>
</body>
</html>
我想采取&#39; saledate&#39;并将其纳入销售金额表格。
答案 0 :(得分:0)
在vb中设置您的值,并在“销售金额”表单中添加 asp:TextBox 控件而不是 html 控件。 您可以通过以下方式更改代码来实现:
' Create a DataReader and execute the command
objDR = objCmd.ExecuteReader
While objDR.Read()
sale_id = objDR(0)
cust_id = objDR(1)
agent_id = objDR(2)
saledate = objDR(3)
actualamount = objDR(4)
contractid = objDR(5)
homeid = objDR(6)
End While
strSuccess.Text = "<h2>Sale ID #" & agent_id & " and " & actualamount & "</h2>"
strSuccess.Visible = "True"
txtsaledate.Text = saledate 'Set value here
' Close all objects
objDR.Close
objCmd.Dispose
objDBConn.Close
End Sub
</script>
<title>CUSTOMERS table</title>
</head>
<body>
<form id="frm" runat="server">
<center>
<h2>Oracle sales table contents</h2>
<asp:label id="strSuccess" runat="server" />
Sale Amount: <asp:TextBox ID="txtsaledate" runat="server"></asp:TextBox>
</center>
</form>
</body>
</html>