Rows not being seem correctly

matt09524

Well-known member
Joined
Sep 14, 2005
Messages
47
The code blow works... sort of. It will only display the first row of data provided. Any number of rows past that it will display only the second one. When I tried to use the .Count function, it only will ever see one row (the Count() sub returns "Currently viewing record 1 of 1"). I have tried up to 5 rows and still only the second one will display. If I got back to one row, it will display that first row. When I added a datagrid to the form, it populated just fine with all the data. Not sure whats going on here.


Code:
Private Sub Connection() 
        DbConnCC = New OleDbConnection(connectString) 
        DbAdaptCC = New OleDbDataAdapter(querySQL, connectString) 
        Try 
             Fill and close data connection. 
            DbAdaptCC.Fill(DbDataCC) 

             Create databindings. 
            ckspouse.DataBindings.Add("Checked", DbDataCC, "table.ccspouseck") 
            lastname.DataBindings.Add("text", DbDataCC, "table.cclast") 
            firstname.DataBindings.Add("text", DbDataCC, "table.ccfirst") 
            spousename.DataBindings.Add("text", DbDataCC, "table.ccspouse") 
            familyname.DataBindings.Add("text", DbDataCC, "table.ccfamily") 
            address.DataBindings.Add("text", DbDataCC, "table.ccaddress") 
            city.DataBindings.Add("text", DbDataCC, "table.cccity") 
            state.DataBindings.Add("text", DbDataCC, "table.ccstate") 
            zipcode.DataBindings.Add("text", DbDataCC, "table.cczip") 
            emailadd1.DataBindings.Add("text", DbDataCC, "table.ccemail1") 
            emailadd2.DataBindings.Add("text", DbDataCC, "table.ccemail2") 
            homephone.DataBindings.Add("text", DbDataCC, "table.cchphone") 
            cellphone1.DataBindings.Add("text", DbDataCC, "table.cccphone1") 
            cellphone2.DataBindings.Add("text", DbDataCC, "table.cccphone2") 
            workphone.DataBindings.Add("text", DbDataCC, "table.ccwphone") 

        Catch Oledb As OleDbException  Catches Database errors seperately 
            MsgBox(Oledb.Message) 
        Catch ex As Exception  Catches other exceptions seperately 
            MsgBox(ex.Message) 
        End Try 

    End Sub 

    Private Sub Count() 
        Records = Me.BindingContext(DbDataCC).Count 
        Current = Me.BindingContext(DbDataCC).Position + 1 
        recordcounter.Text = "Now Viewing record " & Current.ToString & _ 
        " of " & Records.ToString 
    End Sub
 
Tried a few things to get this to work... Tried changing the position of each column to 0 after the dataset is filled. That didnt work. Gave me the "cannot creat child list for field "ccdata." Changed the "ORDER BY" section of the sql query and it seems to work. The row displayed would change based on how the query was ordering the dataset. Im still lost on why it is only displaying one row and wont let me navigate through the rest of the rows that I know are in the dataset (as verified by the datagrid)
 
Can you change the icon on this forum. The thumbs down makes it seem like we failed to answer the question.

I suggest banning the negative post icons.
 
Where are you incrementing the position of the currency manager?

The count function will always return "1 of 1" if the position is always at 0.
 

Attachments

OK. 1. Sorry for the thumbs down thing. I will change it immediately. I did not intend to give that impression.

2. I fixed this. Not really sure how. I did not change the Query or really anything like that. What I did do was add the nav buttons and it cycles through them just fine. I think I was being retarded when posting this thinking it was only showing one row all the time when I think I had the ORDER BY command in the query which I had not yet intended on putting in there.

As far as the counter goes... I found the error with that. I was using "table" as the Datamember in the bindings, but I tried using "dbdatacc" in the Count and Records assignment. I changed it to "table" and it worked fine. I appreciate your feedback :)

/edit I cant seem to change the original posts icon. Could someone please change it for me? I dont want to give people the wrong impression!
 
Back
Top