problem: gridview + oracle

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>
<asp:parameter Name="MOBILE_ID"
Type="Decimal" />
</DeleteParameters>
<UpdateParameters>
<asp:parameter Name="MOBILE_NUMBER" />
<asp:parameter Name="MAKE" />
<asp:parameter Name="MODEL" />
<asp:parameter Name="STATUS" />
<asp:parameter Name="MOBILE_TYPE" />
<asp:parameter Name="OWNER_ID" />
<asp:parameter Name="COMMENTS" />
<asp:parameter Name="MOBILE_ID" />
</UpdateParameters>
<InsertParameters>
<asp:parameter Name="MOBILE_NUMBER" />
<asp:parameter Name="MAKE" />
<asp:parameter Name="MODEL" />
<asp:parameter Name="MOBILE_ID" />
<asp:parameter Name="STATUS" />
<asp:parameter Name="MOBILE_TYPE" />
<asp:parameter Name="OWNER_ID" />
<asp:parameter Name="COMMENTS" />
</InsertParameters>
</asp:SqlDataSource>
 
B

Bruno Alexandre

start by builind a new page with a GridView and change to
AutoGenerateColumns="True"
using the smart tag configure your connection and do not forget to click
Advance when it shows the tables/rows to select and choose AutoGenerate
Insert/Update/Delete statments

then execute it and see if its working...

if Yes, change the code piece by piece and execute everytime you changed so
you can know exactly were is the error if there is one and soon you get the
grid like you want, just copy/paste to the previous page

if Not, there's a problem with your connection or DB, because by default it
always work :)
 
G

guanfenglin

Thanks Bruno,

Bruno said:
start by builind a new page with a GridView and change to
AutoGenerateColumns="True"
using the smart tag configure your connection and do not forget to click
Advance when it shows the tables/rows to select and choose AutoGenerate
Insert/Update/Delete statments

then execute it and see if its working...

if Yes, change the code piece by piece and execute everytime you changed so
you can know exactly were is the error if there is one and soon you get the
grid like you want, just copy/paste to the previous page

if Not, there's a problem with your connection or DB, because by default it
always work :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top