菲
菲菲123
Unregistered / Unconfirmed
GUEST, unregistred user!
mports System.Data.SqlClient
Public Class Catalog
Public Shared Function GetDepartments() As SqlDataReader
Dim connection As New SqlConnection(connectionString)
Dim command As New SqlCommand("GetDepartments", connection)
command.CommandType = CommandType.StoredProcedure
connection.Open()
Return command.ExecuteReader(CommandBehavior.CloseConnection)
End Function
Private Shared ReadOnly Property connectionString() As String
Get
Return ConfigurationSettings.AppSettings("ConnectionString")
End Get
End Property
End Class
###########################################33
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim listIndex As String = Request.QueryString("departmentIndex")
If Not listIndex Is Nothing then
list.SelectedIndex = CInt(listIndex)
End If
list.DataSource = Catalog.GetDepartments()
list.DataBind()
这两段怎么转换成c#语言,谢谢
Public Class Catalog
Public Shared Function GetDepartments() As SqlDataReader
Dim connection As New SqlConnection(connectionString)
Dim command As New SqlCommand("GetDepartments", connection)
command.CommandType = CommandType.StoredProcedure
connection.Open()
Return command.ExecuteReader(CommandBehavior.CloseConnection)
End Function
Private Shared ReadOnly Property connectionString() As String
Get
Return ConfigurationSettings.AppSettings("ConnectionString")
End Get
End Property
End Class
###########################################33
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim listIndex As String = Request.QueryString("departmentIndex")
If Not listIndex Is Nothing then
list.SelectedIndex = CInt(listIndex)
End If
list.DataSource = Catalog.GetDepartments()
list.DataBind()
这两段怎么转换成c#语言,谢谢