Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > ADO.NET
|
ADO.NET For discussion about ADO.NET.  Topics such as question regarding the System.Data namespace are appropriate.  Questions specific to a particular application should be posted in a forum specific to the application .
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ADO.NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 24th, 2004, 06:20 AM
Registered User
 
Join Date: Oct 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Data from dataset

Hi

I wont to extract data from DataSet. I don't wont to bind data to data grid I just wont to calculate average rating from row.
I have code

Private Sub UpdateLabels()
        Dim ds As New Knjizara.DBase
        Dim CmdText As String = "SELECT SUM(rating), COUNT(*) FROM Ratings WHERE BokNummer = " & Session("Vote")
        ds.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=c:\inetpub\wwwroot\Books\books1.mdb"
End Sub

Now I wont to get rating from DataSet.

Thanks

 
Old October 25th, 2004, 07:14 AM
Registered User
 
Join Date: Oct 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I have solved this part of the problem but now i wonder how to get values from columns. Here is my code:
   Private Sub UpdateLabels()
        Dim ds As New Knjizara.DBase
        Dim CmdText As String = "SELECT SUM(rating), COUNT(*) FROM Ratings WHERE BokNummer =" & Session("Vote")
        ds.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=c:\inetpub\wwwroot\Books\books1.mdb"
        ds.ExecuteNonQuery(CmdText)
        Dim value = ds.FillDataSet(CmdText).Tables(0).Columns(0).ToStr ing
        Dim count = ds.FillDataSet(CmdText).Tables(0).Columns(1).ToStr ing
Dim avg = value/count
        Me.AverageLabel.Text = avg
    End Sub

But now I get message that input string is not in correct format.

Thanks


 
Old October 26th, 2004, 07:54 AM
Registered User
 
Join Date: Oct 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Please, someone hwo can show mw how to get values from columns. I badly need that
Thanks

 
Old October 26th, 2004, 08:02 AM
Registered User
 
Join Date: Oct 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Have solution for problem
Thanks anyway






Similar Threads
Thread Thread Starter Forum Replies Last Post
how to format data on dataset bishnupokhrel ASP.NET 2.0 Professional 0 March 21st, 2007 03:23 AM
Sorting data in a DataSet pbyrum ADO.NET 5 May 18th, 2006 05:11 PM
DataSet data busybee ASP.NET 1.0 and 1.1 Basics 0 April 3rd, 2006 05:55 AM
DataSet & data melvik ADO.NET 6 April 28th, 2004 07:58 AM
Dataset Contains Data? ashley_y VB.NET 4 January 29th, 2004 02:58 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.