我正在尝试制作一个简单的程序,将数据库中的数据放入 javascript 数组中,然后在文本框中显示一个结果。这是我到目前为止所拥有的
Dim cmd As New IfxCommand("select first 20 fname from table", conn)
Dim reader As IfxDataReader = cmd.ExecuteReader(CommandBehavior.CloseConnection)
Dim i As Integer = 0
While reader.Read()
ClientScript.RegisterArrayDeclaration("Names", "'" & reader("fname") & "'")
i += 1
End While
Dim cs As StringBuilder = New StringBuilder()
cs.Append("<script type=""text/javascript\""> function DoIt() {")
cs.Append("var TheTextBox = document.getElementById(""TextBox1"");")
cs.Append("TheTextBox.value = Names[0];")
cs.Append("script>")
TextBox1.Text = cs.ToString
这里是asp
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<p>
<asp:Button ID="Button1" runat="server" Text="Button" onclick = "DoIt"/>
</p>
</form>
</body>
</html>
我不知道我还能用这个做什么。