用Oracle数据库,Gridview更新出现ORA-01036问题
<asp:SqlDataSource ID="SqlDataSource1" runat="server"ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>"
SelectCommand="SELECT * FROM "DANWEI""
ConflictDetection="CompareAllValues"
DeleteCommand="DELETE FROM "DANWEI" WHERE (("U_NAME" = :original_U_NAME) OR ("U_NAME" IS NULL AND :original_U_NAME IS NULL)) AND "ID" = :original_ID AND (("P_NAME" = :original_P_NAME) OR ("P_NAME" IS NULL AND :original_P_NAME IS NULL)) AND (("P_PHONE" = :original_P_PHONE) OR ("P_PHONE" IS NULL AND :original_P_PHONE IS NULL)) AND (("X_ID" = :original_X_ID) OR ("X_ID" IS NULL AND :original_X_ID IS NULL)) AND (("TYPE" = :original_TYPE) OR ("TYPE" IS NULL AND :original_TYPE IS NULL)) AND (("T_QX" = :original_T_QX) OR ("T_QX" IS NULL AND :original_T_QX IS NULL))"
InsertCommand="INSERT INTO "DANWEI" ("ID", "U_NAME", "P_NAME", "P_PHONE", "X_ID", "TYPE", "T_QX") VALUES (:ID, :U_NAME, :P_NAME, :P_PHONE, :X_ID, :TYPE, :T_QX)"
OldValuesParameterFormatString="original_{0}"
UpdateCommand="UPDATE "DANWEI" SET "ID" = :ID, "P_NAME" = :P_NAME, "P_PHONE" = :P_PHONE, "X_ID" = :X_ID, "TYPE" = :TYPE, "T_QX" = :T_QX WHERE (("U_NAME" = :original_U_NAME) OR ("U_NAME" IS NULL AND :original_U_NAME IS NULL)) AND "ID" = :original_ID AND (("P_NAME" = :original_P_NAME) OR ("P_NAME" IS NULL AND :original_P_NAME IS NULL)) AND (("P_PHONE" = :original_P_PHONE) OR ("P_PHONE" IS NULL AND :original_P_PHONE IS NULL)) AND (("X_ID" = :original_X_ID) OR ("X_ID" IS NULL AND :original_X_ID IS NULL)) AND (("TYPE" = :original_TYPE) OR ("TYPE" IS NULL AND :original_TYPE IS NULL)) AND (("T_QX" = :original_T_QX) OR ("T_QX" IS NULL AND :original_T_QX IS NULL))">
<DeleteParameters>
<asp:Parameter Name="original_U_NAME" Type="String" />
<asp:Parameter Name="original_ID" Type="Decimal" />
<asp:Parameter Name="original_P_NAME" Type="String" />
<asp:Parameter Name="original_P_PHONE" Type="String" />
<asp:Parameter Name="original_X_ID" Type="Decimal" />
<asp:Parameter Name="original_TYPE" Type="String" />
<asp:Parameter Name="original_T_QX" Type="Decimal" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="ID" Type="Decimal" />
<asp:Parameter Name="P_NAME" Type="String" />
<asp:Parameter Name="P_PHONE" Type="String" />
<asp:Parameter Name="X_ID" Type="Decimal" />
<asp:Parameter Name="TYPE" Type="String" />
<asp:Parameter Name="T_QX" Type="Decimal" />
<asp:Parameter Name="original_U_NAME" Type="String" />
<asp:Parameter Name="original_ID" Type="Decimal" />
<asp:Parameter Name="original_P_NAME" Type="String" />
<asp:Parameter Name="original_P_PHONE" Type="String" />
<asp:Parameter Name="original_X_ID" Type="Decimal" />
<asp:Parameter Name="original_TYPE" Type="String" />
<asp:Parameter Name="original_T_QX" Type="Decimal" />
</UpdateParameters>
<InsertParameters>
<asp:Parameter Name="ID" Type="Decimal" />
<asp:Parameter Name="U_NAME" Type="String" />
<asp:Parameter Name="P_NAME" Type="String" />
<asp:Parameter Name="P_PHONE" Type="String" />
<asp:Parameter Name="X_ID" Type="Decimal" />
<asp:Parameter Name="TYPE" Type="String" />
<asp:Parameter Name="T_QX" Type="Decimal" />
</InsertParameters>
</asp:SqlDataSource>
列表是能出来了。代码都是通过控件自动生成的。现在就是点 编辑——更新 出现ORA-01036错误,请问高手回答 --------------------编程问答-------------------- ORA-01036:非法的变量名/编号
所以请检查你的UpdateCommand内的SQL语句的问题。问题就出在这 --------------------编程问答-------------------- 字段个数和赋值字段的个数不一样?
字段用关键字?
仔细看看吧。你sql语句错误。
你把sql语句赋值到plsql里面 执行看看。就知道问题在哪儿。 --------------------编程问答-------------------- 代码是控件自动生成的。如果要改的话。要怎么改呢?新手。自学的,所以请说明的详细些哦 --------------------编程问答-------------------- Oracle不懂! --------------------编程问答-------------------- 1、Oracle的更新不能出现Parameters顺序跟传来的参数顺序不一直的问题
2、字段名太长,有的地方说是要小于32个字符,但我使用,它还要比32小,大家只能尽量控制字段名的长度
3、虽然在Sql 语句中使用 冒号“:”代表参数,但在创建OracleParameter时,指定的参数名称不能使用冒号,在new OracleParameter时,ParameterName只能使用参数的字符部分 --------------------编程问答-------------------- 查查oracle的错误号 --------------------编程问答-------------------- ...刚学的。不要这么笼统啊
补充:.NET技术 , ASP.NET