G
guanfenglin
Hello,
I have a grid view which display and updates the data, however it
doesn't work well, I always either get invalid name/number or not all
varaibles bound, I am very frustrated at the moment.
Thank you very much!!
Here is the gridview code:
<asp:GridView ID="GridView1" runat="server" AllowPaging="True"
AutoGenerateColumns="False"
DataSourceID="SqlDataSource1"
OnRowUpdated="GridView1_RowUpdated"
OnRowUpdating="GridView1_RowUpdating"
Style="position: relative">
<Columns>
<asp:CommandField ShowDeleteButton="True"
ShowEditButton="True" />
<asp:BoundField DataField="MOBILE_NUMBER"
HeaderText="MOBILE_NUMBER" SortExpression="MOBILE_NUMBER" />
<asp:BoundField DataField="MAKE"
HeaderText="MAKE" SortExpression="MAKE" />
<asp:BoundField DataField="MODEL"
HeaderText="MODEL" SortExpression="MODEL" />
<asp:BoundField DataField="MOBILE_ID"
HeaderText="MOBILE_ID" SortExpression="MOBILE_ID" />
<asp:BoundField DataField="STATUS"
HeaderText="STATUS" SortExpression="STATUS" />
<asp:BoundField DataField="MOBILE_TYPE"
HeaderText="MOBILE_TYPE" SortExpression="MOBILE_TYPE" />
<asp:BoundField DataField="OWNER_ID"
HeaderText="OWNER_ID" SortExpression="OWNER_ID" />
<asp:BoundField DataField="COMMENTS"
HeaderText="COMMENTS" SortExpression="COMMENTS" />
<asp:BoundField DataField="FULL_NAME"
HeaderText="FULL_NAME" SortExpression="FULL_NAME" />
<asp:BoundField DataField="PERSON_ID"
HeaderText="PERSON_ID" ReadOnly="True" SortExpression="PERSON_ID"
Visible="False" />
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1"
runat="server" ConnectionString="<%$ ConnectionStrings:Oracle %>"
DeleteCommand='DELETE FROM "MOBILE" WHERE
"MOBILE_ID" = :MOBILE_ID' InsertCommand='INSERT INTO "MOBILE"
("MOBILE_NUMBER", "MAKE", "MODEL", "MOBILE_ID", "STATUS",
"MOBILE_TYPE", "OWNER_ID", "COMMENTS") VALUES MOBILE_NUMBER, :MAKE,
:MODEL, :MOBILE_ID, :STATUS, :MOBILE_TYPE, :OWNER_ID, :COMMENTS)'
ProviderName="<%$
ConnectionStrings:Oracle.ProviderName %>" SelectCommand='SELECT
"MOBILE_NUMBER", "MAKE", "MODEL", "MOBILE_ID", "STATUS", "MOBILE_TYPE",
"OWNER_ID", "COMMENTS", "PERSON"."FULL_NAME", "PERSON"."PERSON_ID" FROM
"MOBILE" LEFT OUTER JOIN "PERSON" ON "PERSON"."PERSON_ID" =
"MOBILE"."OWNER_ID"'
UpdateCommand='UPDATE "MOBILE" SET
"MOBILE_NUMBER" = :MOBILE_NUMBER, "MAKE" = :MAKE, "MODEL" = :MODEL,
"STATUS" = :STATUS, "MOBILE_TYPE" = :MOBILE_TYPE, "OWNER_ID" =
:OWNER_ID, "COMMENTS" = :COMMENTS WHERE "MOBILE_ID" = :MOBILE_ID'>
<DeleteParameters>
<asparameter Name="MOBILE_ID"
Type="Decimal" />
</DeleteParameters>
<UpdateParameters>
<asparameter Name="MOBILE_NUMBER" />
<asparameter Name="MAKE" />
<asparameter Name="MODEL" />
<asparameter Name="STATUS" />
<asparameter Name="MOBILE_TYPE" />
<asparameter Name="OWNER_ID" />
<asparameter Name="COMMENTS" />
<asparameter Name="MOBILE_ID" />
</UpdateParameters>
<InsertParameters>
<asparameter Name="MOBILE_NUMBER" />
<asparameter Name="MAKE" />
<asparameter Name="MODEL" />
<asparameter Name="MOBILE_ID" />
<asparameter Name="STATUS" />
<asparameter Name="MOBILE_TYPE" />
<asparameter Name="OWNER_ID" />
<asparameter Name="COMMENTS" />
</InsertParameters>
</asp:SqlDataSource>
I have a grid view which display and updates the data, however it
doesn't work well, I always either get invalid name/number or not all
varaibles bound, I am very frustrated at the moment.
Thank you very much!!
Here is the gridview code:
<asp:GridView ID="GridView1" runat="server" AllowPaging="True"
AutoGenerateColumns="False"
DataSourceID="SqlDataSource1"
OnRowUpdated="GridView1_RowUpdated"
OnRowUpdating="GridView1_RowUpdating"
Style="position: relative">
<Columns>
<asp:CommandField ShowDeleteButton="True"
ShowEditButton="True" />
<asp:BoundField DataField="MOBILE_NUMBER"
HeaderText="MOBILE_NUMBER" SortExpression="MOBILE_NUMBER" />
<asp:BoundField DataField="MAKE"
HeaderText="MAKE" SortExpression="MAKE" />
<asp:BoundField DataField="MODEL"
HeaderText="MODEL" SortExpression="MODEL" />
<asp:BoundField DataField="MOBILE_ID"
HeaderText="MOBILE_ID" SortExpression="MOBILE_ID" />
<asp:BoundField DataField="STATUS"
HeaderText="STATUS" SortExpression="STATUS" />
<asp:BoundField DataField="MOBILE_TYPE"
HeaderText="MOBILE_TYPE" SortExpression="MOBILE_TYPE" />
<asp:BoundField DataField="OWNER_ID"
HeaderText="OWNER_ID" SortExpression="OWNER_ID" />
<asp:BoundField DataField="COMMENTS"
HeaderText="COMMENTS" SortExpression="COMMENTS" />
<asp:BoundField DataField="FULL_NAME"
HeaderText="FULL_NAME" SortExpression="FULL_NAME" />
<asp:BoundField DataField="PERSON_ID"
HeaderText="PERSON_ID" ReadOnly="True" SortExpression="PERSON_ID"
Visible="False" />
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1"
runat="server" ConnectionString="<%$ ConnectionStrings:Oracle %>"
DeleteCommand='DELETE FROM "MOBILE" WHERE
"MOBILE_ID" = :MOBILE_ID' InsertCommand='INSERT INTO "MOBILE"
("MOBILE_NUMBER", "MAKE", "MODEL", "MOBILE_ID", "STATUS",
"MOBILE_TYPE", "OWNER_ID", "COMMENTS") VALUES MOBILE_NUMBER, :MAKE,
:MODEL, :MOBILE_ID, :STATUS, :MOBILE_TYPE, :OWNER_ID, :COMMENTS)'
ProviderName="<%$
ConnectionStrings:Oracle.ProviderName %>" SelectCommand='SELECT
"MOBILE_NUMBER", "MAKE", "MODEL", "MOBILE_ID", "STATUS", "MOBILE_TYPE",
"OWNER_ID", "COMMENTS", "PERSON"."FULL_NAME", "PERSON"."PERSON_ID" FROM
"MOBILE" LEFT OUTER JOIN "PERSON" ON "PERSON"."PERSON_ID" =
"MOBILE"."OWNER_ID"'
UpdateCommand='UPDATE "MOBILE" SET
"MOBILE_NUMBER" = :MOBILE_NUMBER, "MAKE" = :MAKE, "MODEL" = :MODEL,
"STATUS" = :STATUS, "MOBILE_TYPE" = :MOBILE_TYPE, "OWNER_ID" =
:OWNER_ID, "COMMENTS" = :COMMENTS WHERE "MOBILE_ID" = :MOBILE_ID'>
<DeleteParameters>
<asparameter Name="MOBILE_ID"
Type="Decimal" />
</DeleteParameters>
<UpdateParameters>
<asparameter Name="MOBILE_NUMBER" />
<asparameter Name="MAKE" />
<asparameter Name="MODEL" />
<asparameter Name="STATUS" />
<asparameter Name="MOBILE_TYPE" />
<asparameter Name="OWNER_ID" />
<asparameter Name="COMMENTS" />
<asparameter Name="MOBILE_ID" />
</UpdateParameters>
<InsertParameters>
<asparameter Name="MOBILE_NUMBER" />
<asparameter Name="MAKE" />
<asparameter Name="MODEL" />
<asparameter Name="MOBILE_ID" />
<asparameter Name="STATUS" />
<asparameter Name="MOBILE_TYPE" />
<asparameter Name="OWNER_ID" />
<asparameter Name="COMMENTS" />
</InsertParameters>
</asp:SqlDataSource>