|
-
May 15th, 2008, 02:57 PM
#1
Re: There is so a row a position 0
at what line you are getting this exception.......what value of ex.tostring
-
May 15th, 2008, 03:01 PM
#2
Frenzied Member
Re: There is so a row a position 0
where is the code for GetDataForGrid(ds)
-
May 15th, 2008, 03:13 PM
#3
Frenzied Member
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.
-
May 15th, 2008, 03:33 PM
#4
Thread Starter
PowerPoster
Re: There is so a row a position 0
 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.
-
May 15th, 2008, 03:27 PM
#5
Thread Starter
PowerPoster
Re: There is so a row a position 0
 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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|