求高手把下面一段VB代码改成C# 在线等
Sub PlayerLogin(Index As Integer, user_id As Long)'01 01 00 08 00 00 00 F9 53 00 00 00 5C C5 70
'F9 53=21497 用户ID
On Error GoTo ErrHandle
Dim aSend() As Byte
Dim user_name As String
Dim union_id As Long
Dim union_name As String
Dim strQ As String
'user_id = 9308
Dim rs As New Recordset
strQ = "select * from sys_user where uid = " & user_id
rs.Open strQ, conn, adOpenKeyset, adLockOptimistic
If rs.RecordCount = 1 Then
user_name = Trim(IIf(IsNull(rs("name").Value), "", rs("name").Value))
union_id = rs("union_id").Value
rs.Close
union_name = ""
strQ = "select * from sys_union where id = " & union_id
rs.Open strQ, conn, adOpenKeyset, adLockOptimistic
If rs.RecordCount = 1 Then
union_name = Trim(IIf(IsNull(rs("name").Value), "", rs("name").Value))
Else
union_id = 0
union_name = "无"
End If
ModifyListitem Index, CStr(user_id), user_name, CStr(union_id), union_name
Text1.Text = "【系统】" & user_name & "-" & union_name & " 成功登陆系统 - " & wsArray(Index).RemoteHostIP & " - " & Time() & vbCrLf & Text1.Text
Else
'找不到角色
wsArray_Close Index
End If
rs.Close
Set rs = Nothing
'aSend = CByteArray("03 0F 00 AE 00 00 00 01 00 00 00 CE 53 02 00 01 01 00 00 FF 00 9E 00 E3 80 90 E6 9C 80 E6 96 B0 E6 B4 BB E5 8A A8 E3 80 91 38 E6 9C 88 34 E6 97 A5 31 36 EF BC 9A 30 30 E5 89 8D EF BC 8C E5 90 84 E6 9C 8D E5 9C A8 E5 AE 98 E6 B8 A1 E4 B9 8B E6 88 98 E6 88 98 E5 9C BA E8 8E B7 E8 83 9C E6 AC A1 E6 95 B0 E6 9C 80 E5 A4 9A E7 9A 84 E5 89 8D 31 30 E4 BD 8D E7 8E A9 E5 AE B6 EF BC 8C E5 9D 87 E5 8F AF E8 8E B7 E5 BE 97 E9 A2 9D E5 A4 96 E5 A5 96 E5 8A B1 EF BC 8C E6 B4 BB E5 8A A8 E8 AF A6 E6 83 85 E8 AF B7 E8 A7 81 E5 AE 98 E7 BD 91 E3 80 82", 1)
'显示顶部红色滚动公告
aSend = CByteArray("03 0F 00 04 00 00 00 00 00 00 00", 1) '回馈空的系统公告
wsArray(Index).SendData aSend
Exit Sub
ErrHandle:
Debug.Print "PlayerLogin():" & Err.Description
End Sub
补充:.NET技术 , C#