AuthorMessage
b_w_johan
Regular
Posts: 56

hi, i need some small help in my aplication
i copyd part of dza, but i want to make some kind of loop in it
Code:
Private Sub Command1_Click()
    Dim FF As Integer                          'dza
    Dim checkfile As String
    mysql.Server = "localhost"
    mysql.Username = "some user"
    mysql.Password = "some pass"
    mysql.Database = "some database"
    mysql.Connect
    FF = FreeFile                                'dza
    'for ff = line 1 to end of file ...
        Open App.Path + "/list.txt" For Input As #FF  'dza
            Dim checkedfile() As String
            Input #FF, CurrentLine: checkfile = CurrentLine   'dza
            checkedfile = Split(checkfile, "    ", , vbTextCompare)
            mysql.Query "INSERT INTO hubs (Id, ReleaseDate, Artist, Song, MusicStyle, Vote, Link, Checked) VALUES('','','" & checkedfile(1) & "','" & checkedfile(2) & "','','','','" & "1" & "')"
        Close #FF                                 'dza
    'next ff
End Sub

lines quoted should be my loop, dza's version worked line for line ....
thx for help b_w_johan
--edit, forgot to add the code things around it
-- edit, i hope the original post is overwritten else, mekka don't mess with my mysql db forgot to make another nick and stuff
lol 8)
dzadzuks
Ametuar
Posts: 135

if you want a loop via all the file ur opening, geting line by line:
Code:

open the_path for input as #ff
do while not eof(ff)    'eof = end of file, so u will loop all of lines in the file WHILE there is not end of the file...
input #ff,SomeString   'SomeString will be a line of the file you are opening
'here you do some functions/procedures or whatever you want to do with that line..
loop
close #ff

hope this helped, if this was what you were looking for 
b_w_johan
Regular
Posts: 56

ty exactly what i needed
for saving and loading it was handy to use that line by line reading and function,
but when you have 5337 mp titles - singers
and you just want to add them to MySQL db its little weird to copy the line 5337 times
now having next problem/ question
i wanna order them, and not by using sql query but in some VB way ... would be something like following lines, but used little different nah well i just need to know howto order alphabetically
Code:

            If music(i) <> "" Then
                'sort by alphabetical order.
                Form1.List1.AddItem music(i)
            End If

music(i)
example
zangeres zonder naam - some title
abba - waterloo
abba - gimme gimme
would become
abba - gimme gimme
abba - waterloo
zangeres zonder naam - some title
--
so i meen not just looking start letter, but complete string
and i'd like to have it in like 1 or 2 lines and not a complete module or something as i found somewhere way to complicated .. must be simpler way to find that...
dzadzuks
Ametuar
Posts: 135

im not sure, but didnt the List component had some sorting option?