谁能把这段代码翻译成delphi代码 ( 积分: 20 )

  • 主题发起人 主题发起人 hongya
  • 开始时间 开始时间
H

hongya

Unregistered / Unconfirmed
GUEST, unregistred user!
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim serveraddr, serveruid, serverpwd, serverdb, Ly885Mir1, Ly885Mir2 As String


serveraddr = "192.168.1.1" 'Sql服务器地址

serveruid = "sa" '用户名
serverpwd = "" '密码
serverdb = "GameDB" '数据库
Ly885Mir1 = "server=" + serveraddr + ";uid=" + serveruid + ";pwd=" + serverpwd + ";database=" + serverdb

Dim objFileStream As FileStream
Dim objBinaryWriter As BinaryWriter
Dim StrId, Sql, Name, Pass, Quiz, Answer, Quiz2, Answer2, Birthday, UserName, Phone, MobliePhone As String
Dim aa, IdLong, i, j As Integer
Dim ChrText(), StrLong(), StrTop(19) As Byte
Sql = Ly885Mir2
StrTop(0) = 0
StrTop(1) = 0
StrTop(2) = 0
StrTop(3) = 0
StrTop(4) = 218
StrTop(5) = 153
StrTop(6) = 244
StrTop(7) = 250
StrTop(8) = 155
StrTop(9) = 211
StrTop(10) = 226
StrTop(11) = 64
StrTop(12) = 218
StrTop(13) = 153
StrTop(14) = 244
StrTop(15) = 250
StrTop(16) = 155
StrTop(17) = 211
StrTop(18) = 226
StrTop(19) = 64
'StrId = Chr(0) + Chr(0) + Chr(0) + Chr(0) + Chr(218) + Chr(153) + Chr(244) + Chr(250) + Chr(155) + Chr(211) + Chr(226) + Chr(64) + Chr(218) + Chr(153) + Chr(244) + Chr(250) + Chr(155) + Chr(211) + Chr(226) + Chr(64)
Dim conPubs As SqlConnection
Dim cmdInsert, comSelectAuthors As SqlCommand
Dim dtrAuthors As SqlDataReader
conPubs = New SqlConnection(Sql)
conPubs.Open()
comSelectAuthors = New SqlCommand("select * from Account", conPubs)
dtrAuthors = comSelectAuthors.ExecuteReader()
For j = 1 To 46095
dtrAuthors.Read()
Name = Trim(dtrAuthors("account"))
Pass = Trim(dtrAuthors("password"))
Quiz = Trim(dtrAuthors("quiz"))
Answer = Trim(dtrAuthors("answer"))
Quiz2 = Trim(dtrAuthors("quiz2"))
Answer2 = Trim(dtrAuthors("Answer2"))
Birthday = Trim(dtrAuthors("birthday"))
UserName = Trim(dtrAuthors("username"))
Phone = Trim(dtrAuthors("Phone"))
MobliePhone = Trim(dtrAuthors("mobilephone"))
StrLong = System.Text.Encoding.Default.GetBytes(Name)
IdLong = StrLong.Length
'StrId = StrId + Name
For i = 1 To 12
StrId = StrId + Chr(0)
Next
StrId = StrId + Chr(IdLong) + Name
For i = 1 To 10 - IdLong
StrId = StrId + Chr(0)
Next
StrLong = System.Text.Encoding.Default.GetBytes(Pass)
IdLong = StrLong.Length
StrId = StrId + Chr(IdLong) + Pass
For i = 1 To 10 - IdLong
StrId = StrId + Chr(0)
Next
StrLong = System.Text.Encoding.Default.GetBytes(UserName)
IdLong = StrLong.Length
StrId = StrId + Chr(IdLong) + UserName
For i = 1 To 20 - IdLong
StrId = StrId + Chr(0)
Next
StrId = StrId + Chr(14) + "650101-1455111"
StrLong = System.Text.Encoding.Default.GetBytes(Phone)
IdLong = StrLong.Length
StrId = StrId + Chr(IdLong) + Phone
For i = 1 To 14 - IdLong
StrId = StrId + Chr(0)
Next
StrLong = System.Text.Encoding.Default.GetBytes(Quiz)
IdLong = StrLong.Length
StrId = StrId + Chr(IdLong) + Quiz
For i = 1 To 20 - IdLong
StrId = StrId + Chr(0)
Next
StrLong = System.Text.Encoding.Default.GetBytes(Answer)
IdLong = StrLong.Length
StrId = StrId + Chr(IdLong) + Answer
For i = 1 To 12 - IdLong
StrId = StrId + Chr(0)
Next
StrId = StrId + Chr(4) + "mail"
For i = 1 To 36
StrId = StrId + Chr(0)
Next
StrLong = System.Text.Encoding.Default.GetBytes(Quiz2)
IdLong = StrLong.Length
StrId = StrId + Chr(IdLong) + Quiz2
For i = 1 To 20 - IdLong
StrId = StrId + Chr(0)
Next
StrLong = System.Text.Encoding.Default.GetBytes(Answer2)
IdLong = StrLong.Length
StrId = StrId + Chr(IdLong) + Answer2
For i = 1 To 12 - IdLong
StrId = StrId + Chr(0)
Next
StrLong = System.Text.Encoding.Default.GetBytes(Birthday)
IdLong = StrLong.Length
StrId = StrId + Chr(IdLong) + Birthday
For i = 1 To 10 - IdLong
StrId = StrId + Chr(0)
Next
StrLong = System.Text.Encoding.Default.GetBytes(MobliePhone)
IdLong = StrLong.Length
StrId = StrId + Chr(IdLong) + MobliePhone
For i = 1 To 13 - IdLong
StrId = StrId + Chr(0)
Next

For i = 1 To 89
StrId = StrId + Chr(0)
Next
ChrText = System.Text.Encoding.Default.GetBytes(StrId)
objFileStream = New FileStream("d:/id.db", FileMode.Append)
objBinaryWriter = New BinaryWriter(objFileStream)
objBinaryWriter.Write(StrTop)
objBinaryWriter.Write(ChrText)
objBinaryWriter.Close()
StrId = ""
Next
dtrAuthors.Close()
End Sub
分可以商量!!
 
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim serveraddr, serveruid, serverpwd, serverdb, Ly885Mir1, Ly885Mir2 As String


serveraddr = "192.168.1.1" 'Sql服务器地址

serveruid = "sa" '用户名
serverpwd = "" '密码
serverdb = "GameDB" '数据库
Ly885Mir1 = "server=" + serveraddr + ";uid=" + serveruid + ";pwd=" + serverpwd + ";database=" + serverdb

Dim objFileStream As FileStream
Dim objBinaryWriter As BinaryWriter
Dim StrId, Sql, Name, Pass, Quiz, Answer, Quiz2, Answer2, Birthday, UserName, Phone, MobliePhone As String
Dim aa, IdLong, i, j As Integer
Dim ChrText(), StrLong(), StrTop(19) As Byte
Sql = Ly885Mir2
StrTop(0) = 0
StrTop(1) = 0
StrTop(2) = 0
StrTop(3) = 0
StrTop(4) = 218
StrTop(5) = 153
StrTop(6) = 244
StrTop(7) = 250
StrTop(8) = 155
StrTop(9) = 211
StrTop(10) = 226
StrTop(11) = 64
StrTop(12) = 218
StrTop(13) = 153
StrTop(14) = 244
StrTop(15) = 250
StrTop(16) = 155
StrTop(17) = 211
StrTop(18) = 226
StrTop(19) = 64
'StrId = Chr(0) + Chr(0) + Chr(0) + Chr(0) + Chr(218) + Chr(153) + Chr(244) + Chr(250) + Chr(155) + Chr(211) + Chr(226) + Chr(64) + Chr(218) + Chr(153) + Chr(244) + Chr(250) + Chr(155) + Chr(211) + Chr(226) + Chr(64)
Dim conPubs As SqlConnection
Dim cmdInsert, comSelectAuthors As SqlCommand
Dim dtrAuthors As SqlDataReader
conPubs = New SqlConnection(Sql)
conPubs.Open()
comSelectAuthors = New SqlCommand("select * from Account", conPubs)
dtrAuthors = comSelectAuthors.ExecuteReader()
For j = 1 To 46095
dtrAuthors.Read()
Name = Trim(dtrAuthors("account"))
Pass = Trim(dtrAuthors("password"))
Quiz = Trim(dtrAuthors("quiz"))
Answer = Trim(dtrAuthors("answer"))
Quiz2 = Trim(dtrAuthors("quiz2"))
Answer2 = Trim(dtrAuthors("Answer2"))
Birthday = Trim(dtrAuthors("birthday"))
UserName = Trim(dtrAuthors("username"))
Phone = Trim(dtrAuthors("Phone"))
MobliePhone = Trim(dtrAuthors("mobilephone"))
StrLong = System.Text.Encoding.Default.GetBytes(Name)
IdLong = StrLong.Length
'StrId = StrId + Name
For i = 1 To 12
StrId = StrId + Chr(0)
Next
StrId = StrId + Chr(IdLong) + Name
For i = 1 To 10 - IdLong
StrId = StrId + Chr(0)
Next
StrLong = System.Text.Encoding.Default.GetBytes(Pass)
IdLong = StrLong.Length
StrId = StrId + Chr(IdLong) + Pass
For i = 1 To 10 - IdLong
StrId = StrId + Chr(0)
Next
StrLong = System.Text.Encoding.Default.GetBytes(UserName)
IdLong = StrLong.Length
StrId = StrId + Chr(IdLong) + UserName
For i = 1 To 20 - IdLong
StrId = StrId + Chr(0)
Next
StrId = StrId + Chr(14) + "650101-1455111"
StrLong = System.Text.Encoding.Default.GetBytes(Phone)
IdLong = StrLong.Length
StrId = StrId + Chr(IdLong) + Phone
For i = 1 To 14 - IdLong
StrId = StrId + Chr(0)
Next
StrLong = System.Text.Encoding.Default.GetBytes(Quiz)
IdLong = StrLong.Length
StrId = StrId + Chr(IdLong) + Quiz
For i = 1 To 20 - IdLong
StrId = StrId + Chr(0)
Next
StrLong = System.Text.Encoding.Default.GetBytes(Answer)
IdLong = StrLong.Length
StrId = StrId + Chr(IdLong) + Answer
For i = 1 To 12 - IdLong
StrId = StrId + Chr(0)
Next
StrId = StrId + Chr(4) + "mail"
For i = 1 To 36
StrId = StrId + Chr(0)
Next
StrLong = System.Text.Encoding.Default.GetBytes(Quiz2)
IdLong = StrLong.Length
StrId = StrId + Chr(IdLong) + Quiz2
For i = 1 To 20 - IdLong
StrId = StrId + Chr(0)
Next
StrLong = System.Text.Encoding.Default.GetBytes(Answer2)
IdLong = StrLong.Length
StrId = StrId + Chr(IdLong) + Answer2
For i = 1 To 12 - IdLong
StrId = StrId + Chr(0)
Next
StrLong = System.Text.Encoding.Default.GetBytes(Birthday)
IdLong = StrLong.Length
StrId = StrId + Chr(IdLong) + Birthday
For i = 1 To 10 - IdLong
StrId = StrId + Chr(0)
Next
StrLong = System.Text.Encoding.Default.GetBytes(MobliePhone)
IdLong = StrLong.Length
StrId = StrId + Chr(IdLong) + MobliePhone
For i = 1 To 13 - IdLong
StrId = StrId + Chr(0)
Next

For i = 1 To 89
StrId = StrId + Chr(0)
Next
ChrText = System.Text.Encoding.Default.GetBytes(StrId)
objFileStream = New FileStream("d:/id.db", FileMode.Append)
objBinaryWriter = New BinaryWriter(objFileStream)
objBinaryWriter.Write(StrTop)
objBinaryWriter.Write(ChrText)
objBinaryWriter.Close()
StrId = ""
Next
dtrAuthors.Close()
End Sub
分可以商量!!
 
传奇游戏的
 
这是VB代码吧, 我不太熟悉啊。
 
恩,楼上的厉害阿!!一猜即中!嗬嗬
是啊,怎么改阿?
 
呵呵,不喜欢VB,所以也没怎么学。
 
后退
顶部