Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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 

Posted
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)
Posted

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.

Posted

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!

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...