gpt4 book ai didi

ASP.NET 甲骨文查询

转载 作者:搜寻专家 更新时间:2023-10-30 22:22:15 25 4
gpt4 key购买 nike

什么代码会将查询(或任何查询)的结果放入 HTML 表格中?

ReadOnly QUERY As String = "SELECT * FROM DUAL"

Public Sub page_load()
Dim myConn As New OracleConnection( _
ConfigurationManager.ConnectionStrings("DB").ConnectionString)
myConn.Open()

Dim myCommand As New OracleCommand(QUERY, myConn)
Dim myReader As OracleDataReader
myReader = myCommand.ExecuteReader()

'Insert Code Here'

myConn.Close()
End Sub

最佳答案

首先...使用<asp:Table id="myTable" runat="server"></asp:Table> 将表格添加到您的标记中

然后在你的代码中,试试这个:

While myReader.Read
Dim myRow as HTMLTableRow = New HTMLTableRow

For i as Integer = 0 to myReader.FieldCount- 1
Dim myCell as HTMLTableCell = New HTMLTableCell

myCell.InnterText = myReader.GetString(i)

myRow.Cells.Add(myCell)
Next i

myTable.Rows.Add(myRow)
End While

关于ASP.NET 甲骨文查询,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1976281/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com