为什么我的webservers 没有生成结果集,xml 显示结果如下:
Imports System.Web.Services
<WebService(Namespace := "http://tempuri.org/")> _
Public Class Service1
Inherits System.Web.Services.WebService
#Region " Web 服务设计器生成的代码 "
Public Sub New()
MyBase.New()
'该调用是 Web 服务设计器所必需的。
InitializeComponent()
'在 InitializeComponent() 调用之后添加您自己的初始化代码
End Sub
'Web 服务设计器所必需的
Private components As System.ComponentModel.IContainer
'注意:以下过程是 Web 服务设计器所必需的
'可以使用 Web 服务设计器修改此过程。
'不要使用代码编辑器修改它。
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
components = New System.ComponentModel.Container()
End Sub
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
'CODEGEN: 此过程是 Web 服务设计器所必需的
'不要使用代码编辑器修改它。
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
#End Region
' Web 服务示例
' HelloWorld() 示例服务返回字符串 Hello World。
' 若要生成项目,请取消注释以下行,然后保存并生成项目。
' 若要测试此 Web 服务,请确保 .asmx 文件为起始页
' 并按 F5 键。
'
'<WebMethod()> Public Function HelloWorld() As String
' HelloWorld = "Hello World"
' End Function
<WebMethod(Description:="数据库数据转换成xml的方法")> Public Function readxml()
Dim LstrSQL As String
Dim LConn As System.Data.OleDb.OleDbConnection
'Dim LCmd As System.Data.OleDb.OleDbCommand
Dim LAdapter As System.Data.OleDb.OleDbDataAdapter
Dim da As New DataSet()
Dim MyDataGrid As New DataGrid()
LstrSQL = "SELECT A.STCDT, A.YMDHM, B.TABLECODE FROM dbo.TV_MAXNOTABLECODE_V A INNER JOIN dbo.TV_MAX_V B ON A.STCDT = B.STCDT AND A.YMDHM = B.YMDHM AND B.TABLECODE <> 'ST_RNFL_R'"
Try
LConn = New System.Data.OleDb.OleDbConnection(ConnString)
If LConn.State <> ConnectionState.Open Then LConn.Open()
LAdapter = New System.Data.OleDb.OleDbDataAdapter(LstrSQL, LConn)
da.Reset()
LAdapter.Fill(da, "TableQuery")
' Create and fill a DataSet.
'Dim ds As DataSet = New DataSet()
'LCmd.Fill(ds)
' Bind MyDataGrid to the DataSet. MyDataGrid is the
' ID for the DataGrid control in the HTML section.
MyDataGrid.DataSource = da.Tables("TableQuery").DefaultView
MyDataGrid.DataBind()
Catch ex As Exception
exNoteBugs(ex.Message, "Public Function BindingRepeater")
Finally
'释放资源
DisposeObject(LConn)
LAdapter.Dispose()
da.Dispose()
End Try
'Return Context.Timestamp.TimeOfDay.ToString
'Return Server.MachineName
End Function
end class
xml 显示结果如下:
<?xml version="1.0" encoding="utf-8" ?>
<anyType xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true" xmlns="http://tempuri.org/" />
1。什么东西都没显示,为什么,我的数据库中有数据,
2。我要在asp.net 中如何调用我的这个webservers 应用呢?