Anger, Rage, Confusion...

R

Roy

Ok... Got a master/detail datagrid page with a main datagrid and a
nested one. The nested one I have contained within a user control. It's
editable. All is well. However, I noticed that the query that pulled
the data to the nested grid took some time. "No problemo, I'll just
turn it into a stored procedure," I said. Which I did... only now it
doesn't work! There are no errors, the nested grid just doesn't display
any data (as if the SP results aren't reaching the datagrid). I'm
clueless. What gives? Anyone?

Here's the bind grid function for the nested grid.

*****************************
Sub Bind_FVD_Grid()
FVDConnection = New
SqlConnection("server=localhost;uid=;pwd=;database=test")
Dim FVDCommand As SqlCommand = New SqlCommand ("Get_FVD_Data",
FVDConnection)
Dim FVDAdapter As SqlDataAdapter
Dim DS As New DataSet()

With FVDCommand
..CommandType = CommandType.StoredProcedure
..Parameters.Add (New SqlParameter("@x", SqlDbType.nvarchar)).Value = x
..Parameters.Add (New SqlParameter("@y", SqlDbType.nvarchar)).Value = y
End With

FVDAdapter = New SqlDataAdapter(FVDCommand)
FVDAdapter.Fill(DS,"Results")
FVD_Grid.DataSource = DS.Tables("Results")
FVD_Grid.DataBind()
End Sub
 
R

Roy

Hrmm.... Could it have something to do with my x and y variables being
declared in the vb code as strings yet the parameters are declared as
nvarchar?

I know for a fact that the x and y variables have the correct values,
but if they weren't reaching the stored proc somehow that could explain
the blank datagrid...

Thoughts, anyone?
 
F

Fabio

Hey Roy,
Hrmm.... Could it have something to do with my x and y variables being
declared in the vb code as strings yet the parameters are declared as
nvarchar?

You can use an overload of the SqlParameter constructor that takes also the size
of the field and the source column, eg New SqlParameter("@x",
SqlDbType.nvarchar, 50, "sourcecolumn"). That would solve that.
I know for a fact that the x and y variables have the correct values,
but if they weren't reaching the stored proc somehow that could explain
the blank datagrid...

Silly question, but I have to ask: are you sure that the sproc is returning
exactly the data you want? Have you run it in query analyzer at *all*?
 
R

Roy

Yep, I've tried it. The sql code works and returns values in QA.
It's just that when run, the nested grid only returns the column
headers with no data.
*sigh*

Thanks for the overload tip, I'll give that a try tomorrow.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,076
Latest member
OrderKetoBeez

Latest Threads

Top