如何将存储过程的结果集分配给html表?

时间:2013-05-07 03:04:14

标签: sql vb.net

我正在尝试按姓氏搜索数据库,并将结果集显示在页面上的表格中。不幸的是我不知道该怎么做。

这是存储过程

ALTER PROCEDURE dbo.uspSelectPatient
@lName varchar(25)

AS
SELECT lName, fName, patientId, birthday 
FROM dbo.Patients
WHERE lName = @lName
RETURN

当用户单击按钮时,运行proc。我想我有一切都接受显示器设置。

Protected Sub btnSearch_Click(sender As Object, e As System.EventArgs) Handles btnSearch.Click
    'Open DB
    Dim objCon As New SqlConnection(mstrCN)
    objCon.Open()

    'Define Command
    Dim objCmd As SqlCommand = New SqlCommand("uspSelectPatient", objCon)
    objCmd.CommandType = Data.CommandType.StoredProcedure

    'Define Data Adapter
    Dim objDataAdapter As New SqlDataAdapter(objCmd)

    'Define Dataset
    Dim objDataSet As New Data.DataSet

    'Fill DataSet
    objDataAdapter.Fill(objDataSet, "Search")

    'Not sure what goes here?

    'Close Objects
    objCmd.Dispose()
    objDataAdapter.Dispose()
    objCon.Close()
    objCon.Dispose()

End Sub

0 个答案:

没有答案