如果把vb的语言转成c#的 ( 积分: 50 )

  • 主题发起人 主题发起人 菲菲123
  • 开始时间 开始时间

菲菲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#语言,谢谢
 
还是WEB开发的,你看一下MSDN,不是很好转换吗?
 
后退
顶部