16,720
社区成员
发帖
与我相关
我的任务
分享
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
dim strsql as string = "SELECT [p_id], [p_name] FROM [product_sp] order by p_id desc"
rd_num.DataSource = getDt(strSql)
rd_num.DataTextField = "p_name"
rd_num.DataValueField = "p_id"
rd_num.DataBind()
end sub
Public Function getDt(ByVal strSql As String) As System.Data.DataTable
Dim con As New System.Data.SqlClient.SqlConnection
con.ConnectionString = conString
Dim sda As New System.Data.SqlClient.SqlDataAdapter(strSql, con)
Dim dats As New System.Data.DataSet
Try
sda.Fill(dats)
Catch ex As Exception
End Try
Return dats.Tables(0)
End Function
rd_num.DataSource =GetDt(strsql)
rd_num.DataTextField = "p_name"
rd_num.DataValueField = "p_id"
rd_num.DataBind()