Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
mysql errors
#1
Every time I try to start the server after setting up the database I get an error:

Either BOF or EOF is True, or the current record has been deleted.
Requested operation requires a current record.

I get this if I use the sql_dump in the sticky or the sql dump that comes with the source.

The line that is highlighted if I use the dump from the sticky is

.FKey = CLng(RS("FKey"))

Any insight would be appreciated.

Thanks
Reply
#2
This is how your subs need to look like:
Code:
Dim RS As ADODB.Recordset
        Set RS = New ADODB.Recordset
        RS.Open "QUERY", Conn_Client, adOpenStatic, adLockOptimistic ' now this are a lot of params, google them and you will know what them all do.
        
        RS.MoveFirst
        Variable = RS.Fields("FKey") ' blablabla
        
        RS.Close
    Set RS = Nothing
Reply
#3
Where should that declaration be though?
Reply
#4
Hi again. I appreciated the fast response before.

I found that I had declared RS like you did, but it fails in this block of code:

Code:
For I = 1 To MAX_MAPS
    Call SetStatus("Loading Map " & I & "/" & MAX_MAPS)
    With Map(I)
        .FKey = CLng(RS("FKey"))
        .Name = Trim(CStr(RS("Name")))
        .Revision = CLng(RS("Revision"))
        .Moral = CByte(RS("Moral"))
        .Up = CInt(RS("Up"))
        .Down = CInt(RS("Down"))
        .Left = CInt(RS("mLeft"))
        .Right = CInt(RS("mRight"))
        .Music = CByte(RS("Music"))
        .BootMap = CInt(RS("BootMap"))
        .BootX = CByte(RS("BootX"))
        .BootY = CByte(RS("BootY"))
        .Shop = CByte(RS("Shop"))
        .Indoors = CByte(RS("Indoors"))
        'Load Tiles
        Tiles = Split(Trim(CStr(RS("Tiles"))), "|")
        Q = 0
        For X = 0 To MAX_MAPX
            For Y = 0 To MAX_MAPY
                TileSet() = Split(Tiles(Q), "-")
                .Tile(X, Y).Ground = CInt(TileSet(0))
                .Tile(X, Y).Mask = CInt(TileSet(1))
                .Tile(X, Y).Anim = CInt(TileSet(2))
                .Tile(X, Y).Fringe = CInt(TileSet(3))
                .Tile(X, Y).Type = CInt(TileSet(4))
                .Tile(X, Y).Data1 = CInt(TileSet(5))
                .Tile(X, Y).Data2 = CInt(TileSet(6))
                .Tile(X, Y).Data3 = CInt(TileSet(7))
                Q = Q + 1
            Next Y
        Next X
        
        'Load NPCs
        NPCs = Split(Trim(CStr(RS.Fields("NPCS"))), "-")
        For Q = LBound(NPCs) To UBound(NPCs)
            .Npc(Q + 1) = CByte(NPCs(Q))
        Next Q
        
    End With
    DoEvents
    If I  MAX_MAPS Then
        RS.MoveNext
    End If
Next I

On the line .FKey = CLng(RS("FKey"))

I am not sure what variable you were suggesting to set it equal to...

Any further help would be much appreciated again.

Thanks,
swya
Reply
#5
Upon more investigation, if I change
For I = 1 To MAX_MAPS
to
For I = 1 To 5
(because there are five maps in the database)
it doesn't crash.

I hope maybe this will shed some light as well.
Reply
#6
You need to have the maps... I was assuming your database were full, I mean, it was full of data, but it appears to not be. Do that and it will work.
Reply
#7
I used the SQL dump that was available... Is there an alternate sql dump that will fill the database?

Thanks again, your speedy responses are very impressive in a support forum.

swya
Reply
#8
I made my own xD
Work with this:
Code:
Public Function GetRecordCount(dbTable As String, Optional WH As String = "0") As Long
'Setup database stuff
Dim RS As ADODB.Recordset
Dim i As Long
Dim SQL As String
    Set RS = New ADODB.Recordset
    If WH = "0" Then
        SQL = "SELECT * FROM " & dbTable & ";"
    Else
        SQL = "SELECT * FROM " & dbTable & " WHERE " & WH & ";"
    End If
    
    RS.Open SQL, Conn_Client, adOpenStatic, adLockReadOnly
    
    RS.MoveFirst
    i = RS.RecordCount
    
    RS.Close
    Set RS = Nothing
    GetRecordCount = i
End Function

Public Sub CheckItems()
'Check to see if max items is how many items there are in the database.
Dim RecCount As Long
Dim i As Long
Dim OffSet As Long
Dim RS As ADODB.Recordset

RecCount = GetRecordCount("Items")
OffSet = MAX_ITEMS - RecCount
If OffSet = 0 Then Exit Sub
Set RS = New ADODB.Recordset
RS.Open "SELECT * FROM Items;", Conn_Client, adOpenStatic, adLockOptimistic

If RS.EOF = True Then Exit Sub

RS.MoveFirst
For i = MAX_ITEMS - OffSet + 1 To MAX_ITEMS
    RS.AddNew
    
    RS!FKey = i
    RS!Name = "   "
    RS!Descricao = "   "
    RS!Pic = 0
    RS!Type = 0
    RS!ClassReq = 0
    RS!Data1 = 0
    RS!Data2 = 0
    RS!Data3 = 0
    RS!TwoHanded = 0
    RS!GuildReq = 0
    RS!Poison_Length = 0
    RS!Poisons = False
    RS!Poison_Vital = 0
    RS!IsRangeWeapon = 0
    RS!RangeAmmo = 0
    
    RS.Update
Next i
RS.Close
Set RS = Nothing
End Sub
And remember, run CheckItems() only once!
Reply
#9
I spent some time on this, but I couldn't get this working. I'm still getting the exact same error during compiling.
Reply
#10
You need to fill the data.
You can't have null on every data, just fill the data with zero or null_string/" ", something like that but make the fkey values correct.
And when you add new record, I mean, client side, using the editor, don't add a new record, just update the old one.
Reply
#11
So to use the mysql version, you have to have an entirely full database?
Reply
#12
Yes ^^
That's pain is the ass, but it works great.
Btw, accounts and characters don't, obviously xD
Reply
#13
I have resolved the issue by adding the following:

Code:
Set RS = New ADODB.Recordset
RS.Open "SELECT count(*) FROM shops;", Conn_Server, adOpenStatic, adLockReadOnly
RS.MoveFirst

ShopCount = RS(0)

RS.Close

then instead of

Code:
For I = 1 To MAX_SHOPS

I used

Code:
For I = 1 To ShopCount

This way it seems to try to only load what exists already in the database. Of course I modified Shops, NPCs, Maps et cetera individually, but it is the same code with just a minor adjustment to the query.
Reply
#14
It works also, but then, if you add item 1 and item 3, only, when you load the server it will try to load item 1 and 2 instead of item 1 and 3...

EDIT: nono, it will load item 3 into item 2, I think that's it.
Reply
#15
This should be all right unless an item is deleted? Is that correct?
Reply
#16
Well, in theory yes...but I really think it's better if you fill the data base...
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)