|
-
Oct 26th, 2009, 10:35 AM
#1
Thread Starter
Frenzied Member
[RESOLVED] Gridview Delete
When I click to delete a record on my grid I get this err msg: ORA-01008: not all variables bound
My SELECT and UPDATE buttons work fine. Any suggestions?
Code:
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionString2 %>"
ProviderName="<%$ ConnectionStrings:ConnectionString2.ProviderName %>"
SelectCommand="SELECT SURPLUS_YR, DIV, SEQ_NO, SURPLUS_TYPE, DECAL_NO, FIELD_DESC, FIELD_MFGR, FIELD_SERIAL_NO, ITEM_CONDITION, SURPLUS_REASON FROM SPAR_DECAL_ITEM WHERE (SURPLUS_YR = :SURPLUS_YR) AND (SEQ_NO = :SEQ_NO) AND (DIV = :DIV)"
DeleteCommand="DELETE FROM SPAR_DECAL_ITEM WHERE (SURPLUS_YR = :SURPLUS_YR) AND (DIV = :DIV) AND (SEQ_NO = :SEQ_NO) AND (SURPLUS_TYPE = :SURPLUS_TYPE) AND (DECAL_NO = :DECAL_NO)"
UpdateCommand="UPDATE SPAR_DECAL_ITEM SET FIELD_DESC = :FIELD_DESC, FIELD_MFGR = :FIELD_MFGR, FIELD_SERIAL_NO = :FIELD_SERIAL_NO, ITEM_CONDITION = :ITEM_CONDITION, SURPLUS_REASON = :SURPLUS_REASON WHERE (SURPLUS_YR = :SURPLUS_YR) AND (DIV = :DIV) AND (SEQ_NO = :SEQ_NO) AND (SURPLUS_TYPE = :SURPLUS_TYPE) AND (DECAL_NO = :DECAL_NO)">
<SelectParameters>
<asp:ControlParameter ControlID="txtYr" Name="SURPLUS_YR" PropertyName="Text"
Type="String" />
<asp:ControlParameter ControlID="txtSeqNo" Name="SEQ_NO" PropertyName="Text"
Type="String" />
<asp:ControlParameter ControlID="txtDiv" Name="DIV" PropertyName="Text"
Type="String" />
</SelectParameters>
<DeleteParameters>
<asp:Parameter Name="SURPLUS_YR" Type="String" />
<asp:Parameter Name="DIV" Type="String" />
<asp:Parameter Name="SEQ_NO" Type="String" />
<asp:Parameter Name="SURPLUS_TYPE" Type="String" />
<asp:Parameter Name="DECAL_NO" Type="Decimal" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="FIELD_DESC" Type="String" />
<asp:Parameter Name="FIELD_MFGR" Type="String" />
<asp:Parameter Name="FIELD_SERIAL_NO" Type="String" />
<asp:Parameter Name="ITEM_CONDITION" Type="String" />
<asp:Parameter Name="SURPLUS_REASON" Type="String" />
<asp:Parameter Name="SURPLUS_YR" Type="String" />
<asp:Parameter Name="DIV" Type="String" />
<asp:Parameter Name="SEQ_NO" Type="String" />
<asp:Parameter Name="SURPLUS_TYPE" Type="String" />
<asp:Parameter Name="DECAL_NO" Type="Decimal" />
</UpdateParameters>
</asp:SqlDataSource>
It's tough being an unhandled exception...
___________
VB.NET 2008
VB.NET 2010
ORACLE 11g
CRYSTAL 11
-
Oct 26th, 2009, 10:42 AM
#2
Re: Gridview Delete
Hey,
If you run that delete query directly on the database, using replaced values, does the query work?
Gary
-
Oct 26th, 2009, 11:31 AM
#3
Hyperactive Member
Re: Gridview Delete
 Originally Posted by EyeTalion
When I click to delete a record on my grid I get this err msg: ORA-01008: not all variables bound
My SELECT and UPDATE buttons work fine. Any suggestions?
Code:
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionString2 %>"
ProviderName="<%$ ConnectionStrings:ConnectionString2.ProviderName %>"
SelectCommand="SELECT SURPLUS_YR, DIV, SEQ_NO, SURPLUS_TYPE, DECAL_NO, FIELD_DESC, FIELD_MFGR, FIELD_SERIAL_NO, ITEM_CONDITION, SURPLUS_REASON FROM SPAR_DECAL_ITEM WHERE (SURPLUS_YR = :SURPLUS_YR) AND (SEQ_NO = :SEQ_NO) AND (DIV = :DIV)"
DeleteCommand="DELETE FROM SPAR_DECAL_ITEM WHERE (SURPLUS_YR = :SURPLUS_YR) AND (DIV = :DIV) AND (SEQ_NO = :SEQ_NO) AND (SURPLUS_TYPE = :SURPLUS_TYPE) AND (DECAL_NO = :DECAL_NO)"
UpdateCommand="UPDATE SPAR_DECAL_ITEM SET FIELD_DESC = :FIELD_DESC, FIELD_MFGR = :FIELD_MFGR, FIELD_SERIAL_NO = :FIELD_SERIAL_NO, ITEM_CONDITION = :ITEM_CONDITION, SURPLUS_REASON = :SURPLUS_REASON WHERE (SURPLUS_YR = :SURPLUS_YR) AND (DIV = :DIV) AND (SEQ_NO = :SEQ_NO) AND (SURPLUS_TYPE = :SURPLUS_TYPE) AND (DECAL_NO = :DECAL_NO)">
<SelectParameters>
<asp:ControlParameter ControlID="txtYr" Name="SURPLUS_YR" PropertyName="Text"
Type="String" />
<asp:ControlParameter ControlID="txtSeqNo" Name="SEQ_NO" PropertyName="Text"
Type="String" />
<asp:ControlParameter ControlID="txtDiv" Name="DIV" PropertyName="Text"
Type="String" />
</SelectParameters>
<DeleteParameters>
<asp:Parameter Name="SURPLUS_YR" Type="String" />
<asp:Parameter Name="DIV" Type="String" />
<asp:Parameter Name="SEQ_NO" Type="String" />
<asp:Parameter Name="SURPLUS_TYPE" Type="String" />
<asp:Parameter Name="DECAL_NO" Type="Decimal" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="FIELD_DESC" Type="String" />
<asp:Parameter Name="FIELD_MFGR" Type="String" />
<asp:Parameter Name="FIELD_SERIAL_NO" Type="String" />
<asp:Parameter Name="ITEM_CONDITION" Type="String" />
<asp:Parameter Name="SURPLUS_REASON" Type="String" />
<asp:Parameter Name="SURPLUS_YR" Type="String" />
<asp:Parameter Name="DIV" Type="String" />
<asp:Parameter Name="SEQ_NO" Type="String" />
<asp:Parameter Name="SURPLUS_TYPE" Type="String" />
<asp:Parameter Name="DECAL_NO" Type="Decimal" />
</UpdateParameters>
</asp:SqlDataSource>
hi there...this is my fav question...
item which you are deleting...
does it has any entry in the child table...
if yes...
then error is correct..
else
there is something else...
check and let me know...
-
Oct 26th, 2009, 02:02 PM
#4
Thread Starter
Frenzied Member
Re: Gridview Delete
Yes, it does have an entry to delete? So why does this cause an error?
It's tough being an unhandled exception...
___________
VB.NET 2008
VB.NET 2010
ORACLE 11g
CRYSTAL 11
-
Oct 27th, 2009, 02:29 AM
#5
Re: Gridview Delete
Hey EyeTalion,
Did you see my question? Does the query work directly against the database, if you replace all the parameter values?
Gary
-
Oct 27th, 2009, 04:34 AM
#6
Hyperactive Member
Re: Gridview Delete
 Originally Posted by EyeTalion
Yes, it does have an entry to delete? So why does this cause an error?
if it has an entry i the child table then
you are suppose to delete that record..
then and only then it will allow you to delete record..
to get the things automatically flushed from the child table..
you need to do setting while setting up a relation with tables..
there is a property called...ondeletecascade
mark it as check...then delete won't cause any problem...
hope that helps...
and please follow the GEP13..
he clearly suggested..
is that delete query works on your SQL server..?
-
Oct 27th, 2009, 08:12 AM
#7
Thread Starter
Frenzied Member
Re: Gridview Delete
Gary, I was able to delete the record directly from the database....as far as the OnDeleteCascade, I don't think this is the reason I'm getting an error message, since I'm only trying to delete the child record.
It's tough being an unhandled exception...
___________
VB.NET 2008
VB.NET 2010
ORACLE 11g
CRYSTAL 11
-
Oct 27th, 2009, 08:59 AM
#8
Re: Gridview Delete
Hey,
Can you show the definition of your GridView?
Gary
-
Oct 27th, 2009, 09:23 AM
#9
Thread Starter
Frenzied Member
Re: Gridview Delete
Code:
<asp:GridView ID="gv" runat="server" DataSourceID="SqlDataSource1"
style="top: 590px; left: 14px; position: absolute; height: 50px; width: 882px"
AutoGenerateDeleteButton="True" AutoGenerateEditButton="True"
Font-Bold="False" BorderColor="#3399FF" BorderStyle="Solid" BorderWidth="1px"
Font-Names="Verdana" Font-Size="Small">
<HeaderStyle BackColor="#FFFFCC" Font-Bold="True" Font-Names="Verdana"
Font-Size="X-Small" />
<EditRowStyle Font-Names="Verdana" Font-Size="Small" BackColor="#E9E9E9"/>
<AlternatingRowStyle BackColor="#E1F0FF" />
</asp:gridview>
It's tough being an unhandled exception...
___________
VB.NET 2008
VB.NET 2010
ORACLE 11g
CRYSTAL 11
-
Oct 27th, 2009, 09:35 AM
#10
Re: Gridview Delete
Hey,
Is one of the columns you are selecting the primary key for that table?
I think what you need to do is set the DataKeyNames property of the GridView:
http://msdn.microsoft.com/en-us/libr...akeynames.aspx
Gary
-
Oct 28th, 2009, 08:13 AM
#11
Thread Starter
Frenzied Member
Re: Gridview Delete
Thanks Gary...that was it. I didn't have the DataKeyNames set.
It's tough being an unhandled exception...
___________
VB.NET 2008
VB.NET 2010
ORACLE 11g
CRYSTAL 11
-
Oct 28th, 2009, 09:59 AM
#12
Re: [RESOLVED] Gridview Delete
Woo Hoo!!
Glad to hear you got it working!!
Gary
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
|