Hello Friends,

I know how to connect to MS Access Database using DAO, in Visual Basic 6.0.

I am new to Winsock Control. I completed some basic tutorials of Winsock, so I know how to send messages from Client to Server & vice versa.

But now, I want to to do the following...

"Users logs in through Client...... The login information goes to Server.... Server compares it wid Database & reports to the client if the login is successful or failed."


So can any one tel me how should I do it?

Can some also tell me.... how should I send two seperate strings (username & password) to server???

Thanks

(I am sorry.... if my post is confusing)

Why go through winsock? You don't need to unless you are trying to do this over internet (ie. not lan) and then if you are doing this over the internet then there are many technologies that will allow you to do this via a thin client (think asp). Also, if internet, dao and access are the wrong technologies to use. You would want to use ADO and at least MySQL.

So in short, you do not need the winsock to connect to an access database via dao.


Good Luck

@ vb5prgmr

Okie I ll provide some more background to you... :)

Actually I am working on my College Project. Its called "Cricket Stats Manager" as the project will deal with all the statistical information about the game of cricket & its analysis, etc.

My idea about the project is that......... There will be many Client Apps that will be used by various Statisticians for updating, editing & performing other operations on the Database.

So I want the Client to send data to the Server, so that the Server does the Database updation n editing.

I know that Database Connectivity or ADO has got to do nothing with Winsock, but I am trying to use Winsock for making globally centralised Database.

Practically my Clients, Server & Database will be located on the same machine (since its just a college project).


I hope I am much more clear this time ! ;)

Thanks a lott any ways !! :)

Enjoy! :)

Then you will need to create a listening program on server that will recieve data and command from client and the server program will execute these and/or return results/errors to client programs.

Much easier to use internet connection via ADO on a higher end db.


Good Luck

Thanks !! :)

Basically I am using Winsock only to make my project look much more complicated & to give it a Centralised feeling.

I have only dont handful of programs in Winsock till now.

All I could see was that... "ALL" the data that the Server was recieving from the Client was stored in "ONE" variable.

So logically it seems wrong to store both Username n Password in same variable. Coz then you simply cant check it with Database.

Is it simply my confusion? Or is it just no possible?

Okay, well if you are bent on using winsock then the process would be something like this

Client gathers user information (password, username)

Client opens/connects/sends user info to server

Server Recieves user info and based upon predefined switches or delimeters server parses out (username, password) from information. Then checks that information against database.

If found Then
Server sends back success
Else
Server sends back failure
End If


Good Luck

Yea but thats where I am stuck !!

I dont know how will the Server realise...... whether the data sent by Client is Username or Password !!

I havent yet tried "If (variable name = ) "

It might work !! :)

Okay, let me explain this a little further...

In client program you have two text boxes for user name and password. User enters this information and you build a string to send to the server program. For giggles sake, lets say that this is the string you assemble...

StringVariable = "u=Demi Moore|p=boy toy ashton"

Now you send this string to the server application and when the server application recieves it, it uses code something like this...

Dim CommandArray() As String
Dim LowerBoundsOfArray As Integer, UpperBoundsOfArray As Integer
Dim ForLoopCounter As Integer

Dim UserName As String, Password As String, QueryString As String
Dim UN As Boolean, PW As Boolean, QS As Boolean

Dim CommandString As String, CS As Boolean, BC As Boolean

CommandArray = Split(StringVariable, "|")
LowerBoundsOfArray = LBound(CommandArray)
UpperBoundsOfArray = UBound(CommandArray)

For ForLoopCounter = LowerBoundsOfArray To UpperBoundsOfArray
  If UCase(Left(CommandArray(ForLoopCounter), 1)) = "U" Then
    UserName = Mid(CommandArray(ForLoopCounter), 3)
    UN = True
  ElseIf UCase(Left(CommandArray(ForLoopCounter), 1)) = "P" Then
    Password = Mid(CommandArray(ForLoopCounter), 3)
    PW = True
  ElseIf UCase(Left(CommandArray(ForLoopCounter), 1)) = "C" Then
    CommandString = Mid(CommandArray(ForLoopCounter), 3)
    CS = True
  ElseIf UCase(Left(CommandArray(ForLoopCounter), 1)) = "Q" Then
    QueryString = Mid(CommandArray(ForLoopCounter), 3)
    QS = True
  Else
    'bad command
    BC = True
  End If
Next ForLoopCounter

If UN = True And PW = True Then
  'log in
ElseIf CS = True Then
  'execute command string
ElseIf QS = True Then
  'execute query string
ElseIf BC = True Then
  'notify client that a bad command was passed
Else
  'something wrong
End If

Good Luck

Yea thats what even I was thinking of !! :)


Will try that out !!

Thanks a lott ! :)

Have a good day ! :)

Well good luck with either this method or the SQL/mySQL method.

Thank you ! :)

Will post here after I make some progress ! :)

Bye ! :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.