I would like get the data from sql server TCP port 1433 using winsock control


Private Sub Form_Load()
    winsocktest.Protocol = sckTCPProtocol
    winsocktest.LocalPort = 1433
   ' winsocktest.Listen
End Sub

Private Sub winsocktest_ConnectionRequest( ByVal requestID As Long)
    winsocktest.LocalPort = 1433
    winsocktest.Accept requestID

End Sub

Private Sub winsocktest_DataArrival( ByVal bytesTotal As Long)
    Dim sItemData As String
    winsocktest.GetData sItemData, vbString
    MsgBox sItemData
End Sub

I want some vb code to get remote data and localhost data in binary format

Thanks in advance,
Who is Participating?
AzraSoundConnect With a Mentor Commented:
Use ADO:

Look under the section "To connect to SQL Server running on a remote computer (via an IP address)"
I do not even think it is possible with winsock.

I use TCP and IP address to connect SQL Server using ADO like Azea mentioned.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.