matt09524 Posted October 15, 2005 Posted October 15, 2005 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 what's going on here. 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 Quote
matt09524 Posted October 16, 2005 Author Posted October 16, 2005 Tried a few things to get this to work... Tried changing the position of each column to 0 after the dataset is filled. That didn't 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. I'm still lost on why it is only displaying one row and won't let me navigate through the rest of the rows that I know are in the dataset (as verified by the datagrid) Quote
Administrators PlausiblyDamp Posted October 16, 2005 Administrators Posted October 16, 2005 Could you post the SQL you are using to populate the dataset? Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Diesel Posted October 17, 2005 Posted October 17, 2005 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. Quote
Diesel Posted October 17, 2005 Posted October 17, 2005 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.BindingTest.zip Quote
matt09524 Posted October 17, 2005 Author Posted October 17, 2005 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 can't seem to change the original post's icon. Could someone please change it for me? I don't want to give people the wrong impression! Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.