I get the following error when I try to run the second page:
Compiler Error Message: BC30451: Name 'myDataReader2' is not declared.
Source Error:
Line 56: Response.Write("An error has occurred: " & myException.ToString())
Line 57: Finally
Line 58: If Not myDataReader2 Is Nothing Then
Line 59: myDataReader2.Close()
Line 60: End If
Mark
ltrane923 <[EMAIL PROTECTED]> wrote:
(New discoveries on problem...This is a revision of an earlier
post..Thanks)
I am running into problems when I try to use code behind and removing
the select statements from the page and using a stored procedure
instead.
I have a master data grid that appears based on a selection in a drop
down box that involves 2 tables.
Working example
http://www.loritompkins.com/sqlnop/pulldowngrid2.aspx
Failing example
http://www.loritompkins.com/sqlnop/pulldowngrid7.aspx
The classid column is the column which creates the key relationship
between the two tables.
You make a selection from the class table and clname and classid
paint to a drop down list below. A second statement pivots on the
classid based in the datavalue field.
<asp:DropDownList id="ddl1"
runat="server"
DataTextField="clname"
DataValueField="classid"
AutoPostBack="true" />
<hr>
<asp:DataGrid id="myDataGrid"
runat="server" />
</form>
Second statement (works in page, fails as stored procedure)
Dim myCommand As SqlCommand = new SqlCommand("Select * From
dbo.ClassDescription Where classid='" & ddl1.SelectedItem.Value
& "'",myConnection)
The stored procedure does not recognize classid='" &
ddl1.SelectedItem.Value & "'"
If it's embedded in the page as a select statement it works.
Thinking that it needs to recognize a page object I have tried
putting the grid into an html table control�Didn't help.
I'm wondering if there's a way to pass the classname and
class id's
as parameters.
Here's the stored procedure which is failing.
CREATE PROCEDURE dbo.proc_selDesc2 AS
Select * From dbo.ClassDescription d, dbo.Classes c
Where d.classid=c.classid
and c.clname= ' "& ddl1.SelectedValue.Text & " '
GO
Yahoo! Groups Sponsor
Get unlimited calls to
U.S./Canada
---------------------------------
Yahoo! Groups Links
To visit your group on the web, go to:
http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/
To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
[Non-text portions of this message have been removed]
------------------------ Yahoo! Groups Sponsor --------------------~-->
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/saFolB/TM
--------------------------------------------------------------------~->
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/