problem: gridview + oracle

Discussion in 'ASP .Net' started by guanfenglin@gmail.com, Jun 14, 2006.

  1. Guest

    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, 2006
    #1
    1. Advertising

  2. 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)


    <> escreveu na mensagem
    news:...
    > 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>
    >
    Bruno Alexandre, Jun 14, 2006
    #2
    1. Advertising

  3. Guest

    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)
    >
    >
    > <> escreveu na mensagem
    > news:...
    > > 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, 2006
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. vaidas gudas
    Replies:
    1
    Views:
    432
    =?Utf-8?B?Q293Ym95IChHcmVnb3J5IEEuIEJlYW1lcikgLSBN
    Oct 11, 2004
  2. =?Utf-8?B?TmVv?=
    Replies:
    2
    Views:
    681
    =?Utf-8?B?TWljaGFlbCBCYWx0aWM=?=
    Jul 12, 2005
  3. Benson, John
    Replies:
    1
    Views:
    2,202
    Aurelio Martin
    Jan 28, 2004
  4. Pieter Claerhout
    Replies:
    0
    Views:
    591
    Pieter Claerhout
    Jan 28, 2004
  5. Feyruz
    Replies:
    4
    Views:
    2,123
    Sherm Pendley
    Oct 14, 2005
Loading...

Share This Page