Welcome to Dream.In.Code
Become a VB.NET Expert!

Join 150,092 VB.NET Programmers for FREE! Get instant access to thousands of VB.NET experts, tutorials, code snippets, and more! There are 1,815 people online right now. Registration is fast and FREE... Join Now!




Dataview and databinding help needed

 
Reply to this topicStart new topic

Dataview and databinding help needed

Mickstar
28 Apr, 2008 - 02:55 AM
Post #1

New D.I.C Head
*

Joined: 15 Mar, 2008
Posts: 3

Hi Experts,

I need help with a databinding in a text box, which draws a column from a dataview.

the sql statement used for the dataview is:

SELECT ArtistID, SUM(Popularity) from ArtistPopularity WHERE NOW >= PeriodStart AND NOW <= PeriodEnd GROUP BY ArtistID

The dataview is row filtered by artist id. The artist id can be selected through a combobox.

The crux of the issue is that not all artists will have a popularity, so this means there will be null values for some artists. So when you scroll through the artist id's in the combobox, only ones with popularities should come up in the dataview.

First i got an indexoutofrange exception, stating that there is no row at positiong 2, this is down to the fact that position 2 in the dataview does not have a value so i caught the exception like so:

Try

TextBox13.Text = oArtistPopularity3DT.Rows(TextBox1.Text).Item("Popularity")

Catch ex As Exception
End Try

But now the problem i face, is that the textbox does not update to the values inside of the datview now. It just remains the same as the last value, before it catches the index out of range.

How do i make it show the value in the textbox, when there is a value in the dataview.


Any help is much appreciated

thanks.

This post has been edited by Mickstar: 28 Apr, 2008 - 02:55 AM
User is offlineProfile CardPM
+Quote Post

gever
RE: Dataview And Databinding Help Needed
5 Nov, 2008 - 10:17 PM
Post #2

New D.I.C Head
*

Joined: 19 Jun, 2008
Posts: 19



Thanked: 1 times
My Contributions

TextBox1.text = DtaView(rowIndex)("Field_Name").ToString()

for more help -

http://vb.net-informations.com/dataview/ado.net-dataview.htm

cheers.

User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/9/09 12:04AM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live VB.NET Help!

VB.NET Tutorials

Reference Sheets

VB.NET Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month