Click here to Skip to main content
12,357,105 members (69,299 online)

There is no row at position 0.

armarzook asked:

Open original thread
Dear Coders,

Please Help,

The code is below. When executing it works fine. but when exiting the program the Following Error Occurs. "There is no row at position 0"
Please Help.

Private Sub Mat_Sub_NoComboBox_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Mat_Sub_NoComboBox.SelectedIndexChanged
 
    TextBox1.Text = Mat_Sub_NoComboBox.SelectedValue
 
    con.ConnectionString = myconstring
 
    'Fetch Project_id to textbox
    Dim Prjda As New SqlDataAdapter("SELECT trade FROM Mat_e1_prj where mat_sub_no='" + Mat_Sub_NoComboBox.SelectedValue + "'", con)
    Dim Prjdt As New DataTable
    Prjda.Fill(Prjdt)
    Project_IDTextBox.Text = Prjdt.Rows(0).Item("Trade")
Tags: VB, VB.NET, Visual-Studio

Preview



When answering a question please:
  1. Read the question carefully.
  2. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  3. If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
Let's work to help developers, not make them feel stupid.
Please note that all posts will be submitted under the The Code Project Open License (CPOL).



Advertise | Privacy | Mobile
Web02 | 2.8.160621.1 | Last Updated 26 Mar 2009
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100