Help... SQL

If you need help with a project or need to know how to do something specific in VB.NET then please ask your questions in here.
Forum rules
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
11 posts Page 1 of 2
Contributors
User avatar
Dummy1912
VIP - Donator
VIP - Donator
Posts: 1969
Joined: Sat Aug 21, 2010 2:17 pm

Help... SQL
Dummy1912
Hello,

seems if i use a separate search form to search my listview
it appears to load once and after a new search nothing happens

can anyone help me please.

after search:
Code: Select all
If FrmSearch.IsDisposed Then FrmSearch = New FrmSearch
        If Not FrmSearch.IsDisposed Then FrmSearch.BringToFront()
        If FrmSearch.ShowDialog(Me) = DialogResult.OK Then

            If lstTrans.Visible Then
                Try

                Catch ex As Exception

                End Try
            End If

            If lstloan.Visible Then
                If searchbyname Then' boolean
                    SQl = "SELECT DISTINCT loananddebt.id,loananddebt.type,addresspayee.name,loananddebt.repayment,loanandd​ebt.paid,loananddebt.date_,loananddebt.due,loananddebt.last_payment,users.name Relation FROM loananddebt LEFT JOIN addresspayee ON loananddebt.description=addresspayee.id LEFT JOIN users ON loananddebt.by=users.id where addresspayee.name LIKE '" & search & "%'"
                    StartSearchLoan()
    
                End If

            End If



        End If
    End Sub
loading:
Code: Select all
Dim SQLconnect As New SQLite.SQLiteConnection()
        Dim SQLcommand As SQLiteCommand

        Try
            lstloan.Items.Clear()
            lstloan.Controls.Clear()

            ClearFields()

            SQLconnect.ConnectionString = "Data Source=" & sPath & filename & ";"
            If SQLconnect.State <> ConnectionState.Open Then 'open Conn just before execution
                SQLconnect.Open()
            End If
            SQLcommand = SQLconnect.CreateCommand

            SQLcommand.CommandText = SQl
            Dim SQLreader As SQLiteDataReader = SQLcommand.ExecuteReader()
            While SQLreader.Read()
If SQLreader(0).ToString = "" Then
                        empty_debt = "1"
                    Else
                        empty_debt = SQLreader(0)
                    End If
End While
            SQLcommand.Dispose()
            SQLconnect.Close()
thanks
visit us on:


http://www.softpedia.com/get/System/Lau ... -Run.shtml
Check it out ! http://www.softpedia.com/publisher/I-A- ... 90017.html
Check it out ! http://www.softpedia.com/get/Desktop-En ... lock.shtml
User avatar
Dummy1912
VIP - Donator
VIP - Donator
Posts: 1969
Joined: Sat Aug 21, 2010 2:17 pm

Re: Help... SQL
Dummy1912
it seems when i remove the searchbyname
it works like a charm
but how can i use this so it always reload the data after new search.
visit us on:


http://www.softpedia.com/get/System/Lau ... -Run.shtml
Check it out ! http://www.softpedia.com/publisher/I-A- ... 90017.html
Check it out ! http://www.softpedia.com/get/Desktop-En ... lock.shtml
User avatar
Dummy1912
VIP - Donator
VIP - Donator
Posts: 1969
Joined: Sat Aug 21, 2010 2:17 pm

Re: Help... SQL
Dummy1912
so i guess no one has a clue?
thats sad :(
visit us on:


http://www.softpedia.com/get/System/Lau ... -Run.shtml
Check it out ! http://www.softpedia.com/publisher/I-A- ... 90017.html
Check it out ! http://www.softpedia.com/get/Desktop-En ... lock.shtml
User avatar
CodenStuff
Site Admin
Site Admin
Posts: 4392
Joined: Tue Aug 04, 2009 1:47 am

Re: Help... SQL
CodenStuff
I have no idea about this SQL stuff sorry :? . I'm not even sure what the question is to be honest :lol:

You open a search form which works first time, then if you try open it again it doesn't work?
Welcome to CodenStuff.com Learn Code, Love Code. Thank you for being a member of the community.
User avatar
Dummy1912
VIP - Donator
VIP - Donator
Posts: 1969
Joined: Sat Aug 21, 2010 2:17 pm

Re: Help... SQL
Dummy1912
sometimes it can be a mess when i try to explain something :)
well yes i open the search form
when i press ok it start this search part
so it loads the result name + data into the listview
when i try a new search open the search form again
and press ok nothing happens
the search part don't search again so thats my question
why it don't work when i use this searchbyname
if i remove the searchbyname part it works like a charm
but i need that part as well but it only works 1x
to load the new data
visit us on:


http://www.softpedia.com/get/System/Lau ... -Run.shtml
Check it out ! http://www.softpedia.com/publisher/I-A- ... 90017.html
Check it out ! http://www.softpedia.com/get/Desktop-En ... lock.shtml
User avatar
Ffenixw0rks
VIP - Donator
VIP - Donator
Posts: 152
Joined: Sun Jun 19, 2011 2:51 pm

Re: Help... SQL
Ffenixw0rks
Dummy1912 wrote:
it seems when i remove the searchbyname
it works like a charm
but how can i use this so it always reload the data after new search.
Reload is show new data in listview or new search on database?
Next. Why
Code: Select all
If SQLconnect.State <> ConnectionState.Open Then 'open Conn just before execution
    SQLconnect.Open()
End If
If you dispose it after every execution why you won't simple do
Code: Select all
SQLconnect.Open()
?
Also
Code: Select all
If FrmSearch.IsDisposed Then FrmSearch = New FrmSearch
If Not FrmSearch.IsDisposed Then FrmSearch.BringToFront()
should be changed to If ... Then ... Else ... End If
And you should check
Code: Select all
StartSearchLoan()
and
ClearFields()
for any errors.
Image
User avatar
Dummy1912
VIP - Donator
VIP - Donator
Posts: 1969
Joined: Sat Aug 21, 2010 2:17 pm

Re: Help... SQL
Dummy1912
there are no errors.

and i already did do
Code: Select all
If FrmSearch.IsDisposed Then FrmSearch = New FrmSearch
        If Not FrmSearch.IsDisposed Then FrmSearch.BringToFront()
        If FrmSearch.ShowDialog(Me) = DialogResult.OK Then
        
        End If
but like i said it only search the data 1x after a new search it does nothing
why is it so hard to understand me??
visit us on:


http://www.softpedia.com/get/System/Lau ... -Run.shtml
Check it out ! http://www.softpedia.com/publisher/I-A- ... 90017.html
Check it out ! http://www.softpedia.com/get/Desktop-En ... lock.shtml
User avatar
Ffenixw0rks
VIP - Donator
VIP - Donator
Posts: 152
Joined: Sun Jun 19, 2011 2:51 pm

Re: Help... SQL
Ffenixw0rks
Dummy1912 wrote:
there are no errors.

and i already did do
Code: Select all
If FrmSearch.IsDisposed Then FrmSearch = New FrmSearch
        If Not FrmSearch.IsDisposed Then FrmSearch.BringToFront()
        If FrmSearch.ShowDialog(Me) = DialogResult.OK Then
        
        End If
but like i said it only search the data 1x after a new search it does nothing
why is it so hard to understand me??
I meant
Code: Select all
If FrmSearch.IsDisposed Then FrmSearch = New FrmSearch
Else FrmSearch.BringToFront() End If
And have you tried toggling breakpoints on button click or somewhere near the start?
Image
User avatar
Dummy1912
VIP - Donator
VIP - Donator
Posts: 1969
Joined: Sat Aug 21, 2010 2:17 pm

Re: Help... SQL
Dummy1912
hello

i only tried with a messagebox under need it
and seems it showed the messagebox 1x
after new search no messagebox appearance.

so i have no clue why it only works one time.
visit us on:


http://www.softpedia.com/get/System/Lau ... -Run.shtml
Check it out ! http://www.softpedia.com/publisher/I-A- ... 90017.html
Check it out ! http://www.softpedia.com/get/Desktop-En ... lock.shtml
User avatar
Ffenixw0rks
VIP - Donator
VIP - Donator
Posts: 152
Joined: Sun Jun 19, 2011 2:51 pm

Re: Help... SQL
Ffenixw0rks
Dummy1912 wrote:
hello

i only tried with a messagebox under need it
and seems it showed the messagebox 1x
after new search no messagebox appearance.

so i have no clue why it only works one time.
99% that breakpoint will solve this issue. Place iton button click event and "Step into" to see what blocks search.
Image
11 posts Page 1 of 2
Return to “Coding Help & Support”