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

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




No Value Given

 
Reply to this topicStart new topic

No Value Given

elispop122003
10 May, 2008 - 10:42 AM
Post #1

New D.I.C Head
*

Joined: 16 Feb, 2008
Posts: 2

All I am trying to do is get values from the Stats table and display them in a datagrid. Usually a pretty simple task, but for some reason I keep getting the No value given for one or more required parameters. I have a feeling it is going to be something stupid and simple and I am just not seeing it. Please help.

CODE
Private Sub btnFindPlayer_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnFindPlayer.Click
        Try
            sql = "SELECT DateofGame, Opponent, FieldGoals, FreeThrows, ThreePointers, Rebounds, Assist, Steals, Turnovers, Blocks, Points FROM Stats Where PlayerID = " & cbPlayer.SelectedValue & " AND SeasonID = " & cbSeason.SelectedValue
            ds2.Clear()
            daStats = New OleDbDataAdapter(sql, conn)
            daStats.Fill(ds2)
            dg.DataSource = ds2



        Catch ex As Exception
            MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly, "Error")
        End Try
        response = MessageBox.Show("Do You Want To View Player Averages?", "Player Information", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
        If response = 6 Then
            Averages()
        End If
    End Sub

User is offlineProfile CardPM
+Quote Post

Martyr2
RE: No Value Given
10 May, 2008 - 07:51 PM
Post #2

Programming Theoretician
Group Icon

Joined: 18 Apr, 2007
Posts: 5,660



Thanked: 313 times
Expert In: C/C++, Java, VB, VB.NET, C#, PHP, Web Development, HTML & CSS, Javascript

My Contributions
Typically that error you mention occurs when you are trying to specify a column that does not exist in the table. Make sure all columns are in the table and especially playerid and seasonid. Make sure there are no misspellings in the table on the database and that all columns you have specified in the query exist.

Second, make sure that your cbPlayer.SelectedValue and cbSeason.SelectedValue fields are filled with the right data.

I would recommend you output the result of your sql statement to see if it is coming out correctly when choosing your values.

smile.gif
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/8/09 11:55PM

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