Results 1 to 9 of 9

Thread: [RESOLVED] There is so a row a position 0

Hybrid View

  1. #1
    Frenzied Member
    Join Date
    Jan 2006
    Posts
    1,875

    Re: There is so a row a position 0

    at what line you are getting this exception.......what value of ex.tostring

  2. #2
    Frenzied Member
    Join Date
    Nov 2001
    Location
    Mass USA
    Posts
    1,674

    Re: There is so a row a position 0

    where is the code for GetDataForGrid(ds)

  3. #3
    Frenzied Member
    Join Date
    Nov 2001
    Location
    Mass USA
    Posts
    1,674

    Re: There is so a row a position 0

    Also check to see if your page is running through the code twice... sometimes I get buttons that bug out and do that.. in that case I just delete the button and replace it with another.

  4. #4

    Thread Starter
    PowerPoster MMock's Avatar
    Join Date
    Apr 2007
    Location
    My Mustang GT
    Posts
    4,566

    Re: There is so a row a position 0

    Quote Originally Posted by Besoup
    where is the code for GetDataForGrid(ds)
    Code:
        Sub GetDataForGrid()
    
            Dim connString As String = _
                ConfigurationManager.ConnectionStrings("ConnectMe").ConnectionString
    
            Dim conn As New SqlConnection(connString)
    
            Dim command As New SqlCommand()
            command.CommandType = CommandType.StoredProcedure
            command.Connection = conn
    
            command.CommandText = "up_DocList"
    
            command.Parameters.Add(New SqlParameter("@cstmr_addr_ik", Data.SqlDbType.Int))
            command.Parameters("@cstmr_addr_ik").Value = sCustomerAddrIk
    
            Dim adapter As New SqlDataAdapter(command)
            Try
                adapter.Fill(ds)
            Catch ex As Exception
                Response.Write("GetDataForGrid Exception " + ex.Message)
                conn.Close()
                Exit Sub
            Finally
                conn.Close()
            End Try
    
        End Sub
    ds is defined global in the class:
    Code:
        Dim ds As New DataSet
    I should tell you that this was working perfectly when I defined the SqlDataSource in my designer and set the gridview property to use it also in the designer. I was just running a simple stored proc that took one parameter. Now I am making it more sophisticated in that I have to build the WHERE clause in the stored procedure according to what I pass in for criteria. So I moved the logic to the code-behind. But before even adding the logic for the WHERE clause, I thought I'd check to make sure it still works as it was. Good thing, since it doesn't...

    And everything seems to be executing just once... no odd behavior noticed.

    Thanks for your help Besoup and riteshjain1982.

  5. #5

    Thread Starter
    PowerPoster MMock's Avatar
    Join Date
    Apr 2007
    Location
    My Mustang GT
    Posts
    4,566

    Re: There is so a row a position 0

    Quote Originally Posted by riteshjain1982
    at what line you are getting this exception.......what value of ex.tostring
    I am calling the exception handler when this line executes: Me.gvDocList.DataBind()

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width