By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,494 Members | 1,079 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,494 IT Pros & Developers. It's quick & easy.

problem: gridview + oracle

P: n/a
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>

Jun 14 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
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 :-)

--

Bruno Alexandre
(a Portuguese in Københanv, Danmark)
<gu*********@gmail.com> escreveu na mensagem
news:11**********************@y43g2000cwc.googlegr oups.com...
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>

Jun 14 '06 #2

P: n/a
Thanks Bruno,

Bruno Alexandre wrote:
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 :-)

--

Bruno Alexandre
(a Portuguese in Københanv, Danmark)
<gu*********@gmail.com> escreveu na mensagem
news:11**********************@y43g2000cwc.googlegr oups.com...
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>


Jun 14 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.