Results 1 to 9 of 9

Thread: [RESOLVED] Upload from database! Help!

  1. #1

    Thread Starter
    Member
    Join Date
    Jun 2009
    Posts
    40

    Resolved [RESOLVED] Upload from database! Help!

    My friend and I are making a program, and we need some help. We need the option to make the program get info from a place that we always can update, so. This is what we want.

    We got a program there got a button, called "Get Info". When it is pressed the program recive some info from a place that we can update whenever we want.

    Like a database, where people can be updated with data from.

    Like this: in the datebase there is typed "I" and "Like" but, after some time we also want to add "cake" but whitout the person using ouer program, have to download the version 2.

    Any help will be appreciated. Thank you for spending your time helping us!

  2. #2

    Re: Upload from database! Help!

    Ok, so like I don't know but like you used like to much in your comment.

    What I get is that if you retrieve something with the word "cake" (The cake is a lie you know), the program decides to update itself.

    You've got the basics down, but you forget a few things:
    1. Where can it download the update
    2. If its updated, and it reads cake, its going to want to update again, problem!
    3. Where's the database stored

    Solve/Answer those three problems/questions and you should be good to go.

  3. #3

    Thread Starter
    Member
    Join Date
    Jun 2009
    Posts
    40

    Re: Upload from database! Help!

    1. Where can it download the update
    2. If its updated, and it reads cake, its going to want to update again, problem!
    3. Where's the database stored

    1. We don't know how to make this, we dont know anything. right now evrything is beta.
    2. why does i wants to update again? the program got a buttom called Get, and when its press a random value from ouer datebase will be showen in a textbox. ?
    3. we don't got one.

  4. #4
    PowerPoster keystone_paul's Avatar
    Join Date
    Nov 2008
    Location
    UK
    Posts
    3,327

    Re: Upload from database! Help!

    Presumably you want to update all users?

    Are all users on the same physical network, or will you be relying on the internet to retrieve the update?

  5. #5

    Thread Starter
    Member
    Join Date
    Jun 2009
    Posts
    40

    Re: Upload from database! Help!

    Yes we want to update all the users with new info, if they click the button called "get".

    All users are not on the same physical network, therefore we need to rely on the internet.

  6. #6
    PowerPoster keystone_paul's Avatar
    Join Date
    Nov 2008
    Location
    UK
    Posts
    3,327

    Re: Upload from database! Help!

    OK so you need some form of web hosting to store the a file containing the updates, then you can use an httpwebrequest to download it.

    You can see an example of downloading a file in this way here.

  7. #7

    Thread Starter
    Member
    Join Date
    Jun 2009
    Posts
    40

    Re: Upload from database! Help!

    Okay thank you for the help! I will try it out.

  8. #8

    Thread Starter
    Member
    Join Date
    Jun 2009
    Posts
    40

    Exclamation Re: Upload from database! Help!

    Okay we tried it out and edited a bit in the code.


    Code:
    Imports System.IO
    Imports System.Net
    Imports System.Text
    Class WebRetrieve
        Public Shared Sub Main()
            Dim wr As HttpWebRequest = CType(HttpWebRequest.Create("http:/xxxxx.com/xxx.txt"), HttpWebRequest)
            Dim ws As HttpWebResponse = CType(wr.GetResponse(), HttpWebResponse)
            Dim str As Stream = ws.GetResponseStream()
            Dim inBuf(100000) As Byte
            Dim bytesToRead As Integer = CInt(inBuf.Length)
            Dim bytesRead As Integer = 0
            While bytesToRead > 0
                Dim n As Integer = str.Read(inBuf, bytesRead, bytesToRead)
                If n = 0 Then
                    Exit While
                End If
                bytesRead += n
                bytesToRead -= n
            End While
            str.Close()
    
            Dim fileContent As String = System.Text.ASCIIEncoding.ASCII.GetString(inBuf)
            Dim sReader As New StringReader(fileContent)
    
            While sReader.Peek() <> -1
                Dim line As String = sReader.ReadLine()
                Dim linecontent() As String = line.Split(CChar(" "))
                Debug.WriteLine(String.Format("Username is {0} and status is {1}", linecontent(0), linecontent(1))
            End While
        End Sub 'Main
    End Class 'WebRetrieve
    We got that part of the code. The problem is now that we do not know how to read the code that we just got. We would like to read the txt file when we click a button called "get". But! we need to get a random line and add it to txtbox1, which is the user, and txtbox2, which is the status.


    xxx.txt:
    Code:
    user1 status1
    user2 status2
    user3 status3
    etc...
    So the program needs to read a random line and add it to two textboxes.

    Any help will be appriciated
    Last edited by Quazaka; Jun 8th, 2009 at 07:41 AM.

  9. #9

    Thread Starter
    Member
    Join Date
    Jun 2009
    Posts
    40

    Re: Upload from database! Help!

    We solved the problem. Thanks anyway

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width