how to get the data from server database???

Post here all your questions related with SmartFoxServer .Net/Unity3D API

Moderators: Lapo, Bax

liverol
Posts: 31
Joined: 15 Jul 2009, 23:49

how to get the data from server database???

Postby liverol » 09 Dec 2009, 09:44

hi there,i am using sfs pro demo+unity3d for a testing mmo project,so far so good,but i got a question:


i created a database using h2 database,i used the h2 database console to create a simple database with a table like this:

id name
0 amy
1 jack
2 bob

also i copied ths internaldb.as extension and modified a little for the my own database!

in unity3d,i just use the sfsisland demo for testing, some test functions:

Code: Select all

....
if(Input.GetKeyDown(KeyCode.LeftControl))
            {
                
Hashtable h=new Hashtable();
                 smartFoxClient.SendXtMessage("myDataBase", "getList",h,SmartFoxClient.XTMSG_TYPE_XML);
            }
...


i can see the "GetResponse" in unity3d console,and here comes the question:
how should i get the right data returnen from server in the delegate?
i tried convert the data to sfsobject but didn't work...
what should i do if i want to get more data from a bigger database??

public void OnExtensionResponse(object data, string type)
{
print("GetResponse!!!");


how to convert the data to a hashtable like object?????
.....
}

thanks for hints!!
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 10 Dec 2009, 08:38

Hi,
data from server to client (and viceversa) is sent via SFSObject, which works as a "neutral" type for transporting data across the network.
Data coming from a database is no exception to this system. Can you show how you are sending your data from server to client?
Lapo
--
gotoAndPlay()
...addicted to flash games

Return to “.Net / Unity3D API”

Who is online

Users browsing this forum: No registered users and 22 guests