我正在尝试创建一个Web服务,以便根据位于Oracle数据库中的Aliquot表中的项目编号提取aliquot_IDs?例如,对于项目编号123(XYZ),它应提取项目XYZ的所有等分试样。 我只需要看看如何组织代码以及它是否准确。
以下是我创建的.asmx文件
Aliquot.asmx
<%@ WebService Language="vb" Codebehind="Aliquot.asmx.vb" Class="Aliquot" %>
Imports System.Data
Imports System.Web.Services
Imports System.Data.SqlClient
Imports System.Web.Services.Protocols
Imports System.Configuration.ConfigurationManager
Imports Oracle.DataAccess.Client
Imports Oracle.DataAccess.Types
Imports System.Data.OracleClient
<WebService([Namespace]:="http://bioservices.com/webservices/")> _
Public Class Aliquot
Inherits System.Web.Services.WebService
<WebMethod(Description:="Get All Aliquot_IDs from Aliquot table", EnableSession:=False)> _
Public Function GetAliquotID() As DataSet
Dim cmd As SqlCommand = New SqlCommand("Select AliquotID, Name From Aliquots", conn)
Dim AliquotDS As DataSet = New DataSet()
adapter.MissingSchemaAction = MissingSchemaAction.AddWithKey
adapter.Fill(AliquotDS, "Aliquots")
Return AliquotDS
End Function
Public Sub CreateOracleConnection()
Dim ConnectionString As String = _
"Data Source=Oracle8i; Integrated Security=yes"
Using connection As New SqlConnection(ConnectionString)
connection.Open()
Console.WriteLine("ServerVersion: " + connection.ServerVersion _
+ ControlChars.NewLine + "DataSource: " + connection.DataSource)
End Using
End Sub
End Class