Client/Server Source

Joined
Oct 12, 2009
Messages
9
Location
South Africa, Johannesburg
Programming Experience
1-3
Hi all

I'm looking for source code in vb.net 2008 of a client and server (just the basis's) of: - Chat, sent and received files and connecting to a xml database which is hosted on the sever side... if this make any sence to any 1 please help...:(

The rest i can fill in...
 
Cleint/Server connecting My XML

I load my data into a dataset, which work fine over a network, i can save, edit, delete, search and do reports, and all the data is on a remote pc but now I want to do this over the internet ... I can connect to the sever by using a socket and that part work fine.... but when I want to read the data in to my Dataset, I get problem on problem....

any ideas ...
 
Last edited:
XML on a network and it work

This work, just replace the "C:/" with the root where the xml data is host

*******************************************************
VB.NET:
Public ds_Employee As DataSet = New DataSet()

    Dim a As Integer 'the index of the record we are seeing
    Dim count_Employees As Integer 'the number of records 

    Sub sFill()
        txtShortKey.Text = ds_Employee.Tables(0).Rows(a).Item("sKey")
        txtName.Text = ds_Employee.Tables(0).Rows(a).Item("Name")
    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        ds_Employee.ReadXml("C:\ds_Employees.xml", XmlReadMode.Auto)
        'counts the records
        count_Employees = ds_Employee.Tables(0).Rows.Count
    End Sub

    Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
        Try
            ' Update the database with the changes made to the local resident DataSet.
            Dim newRow As DataRow
            newRow = ds_Employee.Tables(0).NewRow()

            newRow("sKey") = txtShortKey.Text
            newRow("Date") = txtName.Text

            ds_Employee.Tables(0).Rows.Add(newRow)
            ds_Employee.WriteXml("C:\ds_Employee.xml", XmlWriteMode.IgnoreSchema)

            count_Employees = count_Employees + 1
            a = 0

            MessageBox.Show("The Employee is successfully updated.", _
                            "Update", MessageBoxButtons.OK, _
                MessageBoxIcon.Information)
        Catch ex As Exception
            MsgBox("Error with the databindings: " + ex.Message)
        End Try
    End Sub

    Private Sub btnSaveEdit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSaveEdit.Click
        'save edit
        ds_Employee.Tables(0).Rows(a).Item("sKey") = txtShortKey.Text
        ds_Employee.Tables(0).Rows(a).Item("Name") = txtName.Text

        ds_Employee.WriteXml("C:\ds_Employees.xml", XmlWriteMode.IgnoreSchema)

        MessageBox.Show("The Employee Details is successfully updated.", _
                                   "Update", MessageBoxButtons.OK, _
                                   MessageBoxIcon.Information)
    End Sub

    Private Sub btnDelete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDelete.Click
        'delete
        If MessageBox.Show("Are you sure you want to delete this from the database?", "Deleteing", _
                                                       MessageBoxButtons.YesNo, MessageBoxIcon.Question) _
                                                       = Windows.Forms.DialogResult.Yes Then
            'update employee
            Try
                ds_Employee.Tables(0).Rows(a).Delete()
                count_Employees = count_Employees - 1
                a = 0
                ds_Employee.WriteXml("C:\ds_Employees.xml", XmlWriteMode.IgnoreSchema)
            Catch ex As Exception
                MsgBox("Error with the databindings: " + ex.Message)
            End Try
        End If
    End Sub

    Private Sub btnFind_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnFind.Click
        For b = 0 To count_Employees - 1
            If ds_Employee.Tables(0).Rows(b).Item("sKey").ToString.ToUpper Like ((txtShortKey.Text.ToUpper) & "*") Then
                a = b
                sFill()
                Exit For
            End If
        Next
    End Sub

*******************************************************

now if somebody now how i can connect this over the internet, using a sever and client method .... pls let me know....
 
Need help

Hi there

How can I connect my database by using a client and a server... the data is host on the server side ..... here r some sample code i used and it work over a network but I need it to work in a TCP socket environment...

***********************************************************
VB.NET:
Public ds_Employee As DataSet = New DataSet()

    Dim a As Integer 'the index of the record we are seeing
    Dim count_Employees As Integer 'the number of records 

    Sub sFill()
        txtShortKey.Text = ds_Employee.Tables(0).Rows(a).Item("sKey")
        txtName.Text = ds_Employee.Tables(0).Rows(a).Item("Name")
    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        ds_Employee.ReadXml("C:\ds_Employees.xml", XmlReadMode.Auto)
        'counts the records
        count_Employees = ds_Employee.Tables(0).Rows.Count
    End Sub

    Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
        Try
            ' Update the database with the changes made to the local resident DataSet.
            Dim newRow As DataRow
            newRow = ds_Employee.Tables(0).NewRow()

            newRow("sKey") = txtShortKey.Text
            newRow("Date") = txtName.Text

            ds_Employee.Tables(0).Rows.Add(newRow)
            ds_Employee.WriteXml("C:\ds_Employee.xml", XmlWriteMode.IgnoreSchema)

            count_Employees = count_Employees + 1
            a = 0

            MessageBox.Show("The Employee is successfully updated.", _
                            "Update", MessageBoxButtons.OK, _
                MessageBoxIcon.Information)
        Catch ex As Exception
            MsgBox("Error with the databindings: " + ex.Message)
        End Try
    End Sub

    Private Sub btnSaveEdit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSaveEdit.Click
        'save edit
        ds_Employee.Tables(0).Rows(a).Item("sKey") = txtShortKey.Text
        ds_Employee.Tables(0).Rows(a).Item("Name") = txtName.Text

        ds_Employee.WriteXml("C:\ds_Employees.xml", XmlWriteMode.IgnoreSchema)

        MessageBox.Show("The Employee Details is successfully updated.", _
                                   "Update", MessageBoxButtons.OK, _
                                   MessageBoxIcon.Information)
    End Sub

    Private Sub btnDelete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDelete.Click
        'delete
        If MessageBox.Show("Are you sure you want to delete this from the database?", "Deleteing", _
                                                       MessageBoxButtons.YesNo, MessageBoxIcon.Question) _
                                                       = Windows.Forms.DialogResult.Yes Then
            'update employee
            Try
                ds_Employee.Tables(0).Rows(a).Delete()
                count_Employees = count_Employees - 1
                a = 0
                ds_Employee.WriteXml("C:\ds_Employees.xml", XmlWriteMode.IgnoreSchema)
            Catch ex As Exception
                MsgBox("Error with the databindings: " + ex.Message)
            End Try
        End If
    End Sub

    Private Sub btnFind_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnFind.Click
        For b = 0 To count_Employees - 1
            If ds_Employee.Tables(0).Rows(b).Item("sKey").ToString.ToUpper Like ((txtShortKey.Text.ToUpper) & "*") Then
                a = b
                sFill()
                Exit For
            End If
        Next
    End Sub
*******************************************************

now if somebody now how i can connect this over the internet, using a sever and client method .... pls let me know....
 
Back
Top