Converting local to SQL

This topic is 2647 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

Hey there, so basically I'm working on converting a game server (written in VB6), that saves account information locally, to one that saves in through MySQL. I'd prefer not having to do this (as it seems like a lot of work), but if so, is there an efficient way to do this? Am I better off just leaving the server file as is? Here's the source for the game server

 Sub LoadPlayer(ByVal index As Long, ByVal Name As String) Dim filename As String Dim F As Long Call ClearPlayer(index) filename = App.Path & "\data\accounts\" & Trim(Name) & ".bin" F = FreeFile Open filename For Binary As #F Get #F, , Player(index) Close #F End Sub 

Any and all help/criticism/advice is welcome!

Share on other sites
What reasons do you have for wanting to use a relational DB for storing your server data? Also, you'd probably get a lot more help if you isolated the pieces of code that actually do the reading/writing of the server data, and limit those to the data you want stored. Otherwise no one is going to sift through hundreds of lines of VB code to find the relevant portions.

Share on other sites
Sorry about the code, all the functions are relevant, ban lists, adding players, removing players. I'll just isolate the section I would say is most important. I assume saving account information to a database, rather than a simple text file, is much safer.

This is how the current source saves account information

I just want some better protection. I understand that I'd have to connect to the database in question
 Private Sub cmdConnectMySQL_Click() Dim cnMySql As New rdoConnection Dim rdoQry As New rdoQuery Dim rdoRS As rdoResultset cnMySql.CursorDriver = rdUseOdbc cnMySql.Connect = "uid=YourUserName;pwd=YourPassword; server=YourServerName;" & _ "driver={MySQL ODBC 3.51 Driver}; database=YourDataBase;dsn=;" cnMySql.EstablishConnection With rdoQry .Name = "selectUsers" .SQL = "select * from user" .RowsetSize = 1 Set .ActiveConnection = cnMySql Set rdoRS = .OpenResultset( rdOpenKeyset, rdConcurRowVer) End With ' loop through the record set ' processing the records and fields. Do Until rdoRS.EOF With rdoRS ' your code to process the fields rdoRS.MoveNext End With Loop ' close record set ' close connection to the database rdoRS.Close cnMySql.Close End Sub

But what else needs to go into it?

1. 1
2. 2
Rutin
20
3. 3
khawk
18
4. 4
A4L
14
5. 5

• 12
• 16
• 26
• 10
• 44
• Forum Statistics

• Total Topics
633760
• Total Posts
3013722
×