D
David R. Longnecker
I'm migrating existing ASP 3.0 web applications to C#/2.0 and have run into
an error that has stumped me. The Gridview is designed to replace an
old-fashioned loop through a database that writes out textboxes of user
information for a "semi-user maintenance" screen. The gridview reads out of
an Oracle database (no problems there) and I'm manually adding the
INSERT/UPDATE/DELETE commands to my SqlDataSource; however, no matter what
format I try, the variables come back with:
--
ORA-01036: illegal variable name/number
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.
Exception Details: System.Data.OracleClient.OracleException: ORA-01036:
illegal variable name/number
--
I researched the error and found similar posts with the error
(http://objectsharp.com/Blogs/bruce/archive/2004/09/17/883.aspx); however,
as you can see in my code below (unless I misunderstand), my variables are
far under the 32-character limit (unless it's a collective limit or
something). So far, the MSDN library/premier library hasn't turned up
anything for the Oracle error. The Oracle site gives me that the error
means: --Unable to find bind context on user side. Make sure that the
variable being bound is in the SQL statement.--
(http://forums.oracle.com/forums/thread.jspa?messageID=1130432); however,
that seems focused around 1.1 and not the new gridviews of 2.0.
My GirdView/SqlDataSource code:
--
<asp:GridView ID="staffTable" runat="server" AllowSorting="True"
AutoGenerateColumns="False"
CellPadding="4" DataSourceID="sqlStaffMaint" DataKeyNames="staff_id"
AllowPaging="True"
PageSize="100" AutoGenerateDeleteButton="true"
AutoGenerateEditButton="true">
<Columns>
<asp:BoundField DataField="STAFF_ID" Visible="False" />
<asp:BoundField DataField="AD_ID" HeaderText="User Name"
SortExpression="AD_ID" />
<asp:BoundField DataField="ESIS_ID" HeaderText="SSN"
SortExpression="ESIS_ID" />
<asp:BoundField DataField="SCHOOL_ID" HeaderText="School #"
SortExpression="SCHOOL_ID" />
<asp:BoundField DataField="ACCESS_ID" HeaderText="Access Level"
SortExpression="ACCESS_ID" />
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="sqlStaffMaint" runat="server"
ConnectionString="<%$ ConnectionStrings:addStaffCS %>"
ProviderName="<%$ ConnectionStrings:addStaffCS.ProviderName %>"
SelectCommand="SELECT * FROM staff"
UpdateCommand="UPDATE staff SET ad_id=@ad_id, esis_id=@esis_id,
school_id=@school_id, access_id=@access_id WHERE staff_id=@staff_id"
DeleteCommand="DELETE FROM staff where staff_id=@staff_id"
InsertCommand="INSERT INTO staff (ad_id, esis_id, school_id,
access_id) VALUES (@ad_id, @esis_id, @school_id, @access_id)">
</asp:SqlDataSource>
--
My web.config connection string information:
--
<connectionStrings>
<add name="addStaffCS" connectionString="Data
Source=server.domain.com;Persist Security Info=True;User
ID=userName;Password=passWord"
providerName="System.Data.OracleClient" />
</connectionStrings>
--
The short (after all of that) seems to be: Can a gridview connect for all
operations (select, insert, update, delete) to an Oracle database? If so,
how do you get around this variable issue?
Thanks in advance!
-David
--
David R. Longnecker
CCNA, MCSA, Network+, A+
Management Information Services
Wichita Public Schools, USD 259
an error that has stumped me. The Gridview is designed to replace an
old-fashioned loop through a database that writes out textboxes of user
information for a "semi-user maintenance" screen. The gridview reads out of
an Oracle database (no problems there) and I'm manually adding the
INSERT/UPDATE/DELETE commands to my SqlDataSource; however, no matter what
format I try, the variables come back with:
--
ORA-01036: illegal variable name/number
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.
Exception Details: System.Data.OracleClient.OracleException: ORA-01036:
illegal variable name/number
--
I researched the error and found similar posts with the error
(http://objectsharp.com/Blogs/bruce/archive/2004/09/17/883.aspx); however,
as you can see in my code below (unless I misunderstand), my variables are
far under the 32-character limit (unless it's a collective limit or
something). So far, the MSDN library/premier library hasn't turned up
anything for the Oracle error. The Oracle site gives me that the error
means: --Unable to find bind context on user side. Make sure that the
variable being bound is in the SQL statement.--
(http://forums.oracle.com/forums/thread.jspa?messageID=1130432); however,
that seems focused around 1.1 and not the new gridviews of 2.0.
My GirdView/SqlDataSource code:
--
<asp:GridView ID="staffTable" runat="server" AllowSorting="True"
AutoGenerateColumns="False"
CellPadding="4" DataSourceID="sqlStaffMaint" DataKeyNames="staff_id"
AllowPaging="True"
PageSize="100" AutoGenerateDeleteButton="true"
AutoGenerateEditButton="true">
<Columns>
<asp:BoundField DataField="STAFF_ID" Visible="False" />
<asp:BoundField DataField="AD_ID" HeaderText="User Name"
SortExpression="AD_ID" />
<asp:BoundField DataField="ESIS_ID" HeaderText="SSN"
SortExpression="ESIS_ID" />
<asp:BoundField DataField="SCHOOL_ID" HeaderText="School #"
SortExpression="SCHOOL_ID" />
<asp:BoundField DataField="ACCESS_ID" HeaderText="Access Level"
SortExpression="ACCESS_ID" />
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="sqlStaffMaint" runat="server"
ConnectionString="<%$ ConnectionStrings:addStaffCS %>"
ProviderName="<%$ ConnectionStrings:addStaffCS.ProviderName %>"
SelectCommand="SELECT * FROM staff"
UpdateCommand="UPDATE staff SET ad_id=@ad_id, esis_id=@esis_id,
school_id=@school_id, access_id=@access_id WHERE staff_id=@staff_id"
DeleteCommand="DELETE FROM staff where staff_id=@staff_id"
InsertCommand="INSERT INTO staff (ad_id, esis_id, school_id,
access_id) VALUES (@ad_id, @esis_id, @school_id, @access_id)">
</asp:SqlDataSource>
--
My web.config connection string information:
--
<connectionStrings>
<add name="addStaffCS" connectionString="Data
Source=server.domain.com;Persist Security Info=True;User
ID=userName;Password=passWord"
providerName="System.Data.OracleClient" />
</connectionStrings>
--
The short (after all of that) seems to be: Can a gridview connect for all
operations (select, insert, update, delete) to an Oracle database? If so,
how do you get around this variable issue?
Thanks in advance!
-David
--
David R. Longnecker
CCNA, MCSA, Network+, A+
Management Information Services
Wichita Public Schools, USD 259