Link to home
Start Free TrialLog in
Avatar of falconew
falconew

asked on

Make a Recordset Object

I'd like to make a database server program and client program using Microsoft Winsock Control. The server program will run as a server to serve a request from the client. The client will be able to send the SQL statement and will get the result as recordset. (for example: like SQL Server and ADO Object in the client)
My question is:
How to make an object like ADO Recordset?
is it possible to send the recordset using TCP/IP from the server to the client so the client can navigate through the records just like ADO does with SQL Server.
ASKER CERTIFIED SOLUTION
Avatar of sharmon
sharmon

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Richie_Simonetti
Maybe using a disconnected recordset on client side.
Avatar of falconew
falconew

ASKER

Thanks for your response. The application from the link it refers to is very cool. But I need to make a multipurpose database server like SQL Server and I also want to develop the recordset object myself. I know how to connect and send data using Winsock, but I don't have any idea how to make an object like ADO connecting to SQL Server.
Thanks for your response. The application from the link it refers to is very cool. But I need to make a multipurpose database server like SQL Server and I also want to develop the recordset object myself. I know how to connect and send data using Winsock, but I don't have any idea how to make an object like ADO connecting to SQL Server.
falconew, don't push refresh button from navigator, instead use Reload question at top of page. Doing so, you avoid repeated posts.
Cheers
why using winsock? why not ODBC ?
With ODBC, don't you need to stay on  line?
When re-reading your question, it appears to me now that you don't want to use ADO with SQL server over a winsock connection, you want to create your own SQL type server and ADO type object to communicate and use winsock as the connection between the two?  Is this correct?
no, you just open and transmit on demand...but maybe the question is about streaming raw data without the need of a driver (ODBC)

this question is ambiguious, clarification needed...

Regards,

RayZor
Sharmon, yes you are correct. and I don't want to use the ODBC driver either. I want to create my own SQL Server type if it is possible and my own MS-ADO like. Do you all have any idea how to do this.

Raybeam, Yes I want to send the streaming raw data over TCP/IP network using winsock or anything else if possible but I don't know which the efficient way is if the data are more than thousand records.

Any Idea or suggestion would be be appeciated.
This is definately a non-trivial question. You have to ask yourself what exactly are you trying to acheive? What features does your recordset object need? Does it need to support SQL? Does it need to support editing? Does it need to support data types? And as for the database, what kind of database do you want? Do you want a relational database? What kinds of fields will you support, integer, data, fixed length string, variable length string, blob, etc? These are very important questions which will have a significant impact on your design. And I do know what I am talking about, I have built my own ADO-like object which is used to access and modify tables stored in binary on the disk. Basically it is ADO-lite and SQL Server (more like Access) built into one. However it supports a decent range of SQL select statements including inner joins, comparisons, field naming, etc as well as updates through the record's fields. It supports most datatypes that VB supports except for variable length strings. This was a substantial project and I had to make some significant design decisions to begin with like: how many users should be accessing this database at a time? Generally one. Is performance important? Not terribly. Are bulk updates required? No. Etc etc etc.

Compared to the above, the question of how to transmit the recordset across a network is relatively trivial, but it will depend on what functionality your recordset has? Here's another question, do you want to support server side cursors, client side cursors, or both?

Zaphod.
Thanks for the response.
Ok let me make simple for my question.

Actually I don't need to create my own ADO-like object as complete and excelent as the MS-ADO. But for now I just need to create an object which could send an sql statement to my own server and the server will send back the result to the client. The application for the server will use MS-ADO to access the MSAccess database and using the winsock control to send the result of the query to the client.
In the client program I need to facilitate it with an object which is for just navigating the result.

Actually the URL link from Sharmon is a good example. But when I try to make about one thousand of records in the MSAccess database, the program can not handle so many data and the response is too long.

Do I need a low level programming to achieve this? or any idea how does MSADO and MSSQL communicate?
OK, do you need to make updates, or just get read only recordsets? If it is read only, the easiest way is to use disconnected recordsets. There are lots of websites that discuss how to do this. You can also use disconnected recordsets to do updates, but they will be asynchronous so you may get into replication conflicts. You will probably find that there is a lot of overhead associated with disconnected recordsets, but this is unavoidable unless you can make some simplifying assumptions about the data you are dealing with. If you can, then you can create you own streaming system, although this would not be easy.

Zaphod.
Oops, maybe I wasn't too clear. What I meant was create a disconnected recordset on the server, and then transmit that entire recordset to the client, not making the recordset on the client and then disconnecting it.

Zaphod.
Ok, I know what you mean. But how to transfer such amount of records to the client and the client can navigate the record?

Thanks.
ADO disconnected recordsets have a special feature... they are persistable. What this means is that they have the ability to convert themselves to a stream of bytes, and then 'rehydrate' themselves. What this means is that you can save a disconnected recordset to a file or, in your case, send it accross a socket connection. Unfortunately, all I have is theoretical knowledge of this, I have no idea how you actually go about doing it.....

Actually, I just took a look at the ADODB libary, and there is, in addition to the connection, recordset, etc, a stream object. This looks very interesting. Unfortunately I don't have time to look into it right now, but you should be able to find some documentation on Microsoft's webpage. This might just do exactly what you want :)

Zaphod.
keep in mind the security breach and encryption factor...TCP/IP proctocols aren't 100% secure you know...

I guess the best idea to do so is to send the data and the queries in chunks...make a list of commands you might need, similar to SQL SELECT, DELETE and stuff like that, send the query in chunk and receive the data in chunks...I used this with an SQL server withouth an ODBC driver, I treated the connection as a user and had the Queries sent over TCP/IP and received the results also in chunks...
Thanks for all of your response.
I wish I could give all of you the score :)
Because of no choice, I should go for the Sharmon's answer.