ObjectDataSource and DataSet Update Query Creation

Discussion in 'ASP .Net' started by Hurricane, Apr 24, 2007.

  1. Hurricane

    Hurricane Guest

    I have my SQL database with a table that I am trying to have a
    gridview dislay with inline editing.


    It seems as if the dataset does not generate the apropriate update
    query, and therefore consequently the gridview does not automatically
    allow editing.

    I then try to change which update query that is selected being the
    dataRow, DataSet,dataTable or other DataRow[] And none of them work
    (upon update i get an error about the first field whatever it may be)

    It seems to generate the insert query ok but not the update.



    I also looked at the code of the dataset and see select and insert but
    no update.



    I decided that I would try and have it create stored procedures then
    i looked at the script to create them, I clicked "copy all" and this
    is what the dataset creation wizard was going to complete. Note the
    lack of update or delete.

    IF EXISTS (SELECT * FROM sysobjects WHERE name = 'SelectChecksByLoss'
    AND user_name(uid) = 'dbo')
    DROP PROCEDURE dbo.SelectChecksByLoss
    GO

    CREATE PROCEDURE dbo.SelectChecksByLoss
    (
    @LossID bigint
    )
    AS
    SET NOCOUNT ON;
    SELECT aut_id, txt_check, dat_Date, txt_Payee, mny_Medical,
    mny_Transport, mny_Maintenance, mny_UnearnedWages, mny_Settlement,
    mny_OtherCosts,
    mny_LegalFees, mny_AdjusterFees, mny_Expense,
    dat_DateofService, txt_Description, mny_Reimbursement
    FROM tbl_LossChecks
    WHERE (ulk_loss = @LossID)
    GO

    IF EXISTS (SELECT * FROM sysobjects WHERE name = 'InsertCheck' AND
    user_name(uid) = 'dbo')
    DROP PROCEDURE dbo.InsertCheck
    GO

    CREATE PROCEDURE dbo.InsertCheck
    (
    @txt_check nvarchar(255),
    @dat_Date datetime,
    @txt_Payee nvarchar(255),
    @mny_Medical float,
    @mny_Transport float,
    @mny_Maintenance float,
    @mny_UnearnedWages float,
    @mny_Settlement float,
    @mny_OtherCosts float,
    @mny_LegalFees float,
    @mny_AdjusterFees float,
    @mny_Expense int,
    @dat_DateofService datetime,
    @txt_Description nvarchar(255),
    @mny_Reimbursement float
    )
    AS
    SET NOCOUNT OFF;
    INSERT INTO [tbl_LossChecks] ([txt_check], [dat_Date], [txt_Payee],
    [mny_Medical], [mny_Transport], [mny_Maintenance],
    [mny_UnearnedWages], [mny_Settlement], [mny_OtherCosts],
    [mny_LegalFees], [mny_AdjusterFees], [mny_Expense],
    [dat_DateofService], [txt_Description], [mny_Reimbursement]) VALUES
    (@txt_check, @dat_Date, @txt_Payee, @mny_Medical, @mny_Transport,
    @mny_Maintenance, @mny_UnearnedWages, @mny_Settlement,
    @mny_OtherCosts, @mny_LegalFees, @mny_AdjusterFees, @mny_Expense,
    @dat_DateofService, @txt_Description, @mny_Reimbursement)
    GO

    Any help would be greatly appreciated
    Hurricane, Apr 24, 2007
    #1
    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. =?Utf-8?B?U2NvdHQgUg==?=

    How to pass dataset for update via Objectdatasource

    =?Utf-8?B?U2NvdHQgUg==?=, Oct 23, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    519
    =?Utf-8?B?U2NvdHQgUg==?=
    Oct 23, 2005
  2. Arjen
    Replies:
    0
    Views:
    360
    Arjen
    Aug 24, 2006
  3. David Thielen

    ObjectDataSource method as another ObjectDataSource

    David Thielen, Mar 21, 2006, in forum: ASP .Net Web Controls
    Replies:
    3
    Views:
    242
    Steven Cheng[MSFT]
    Mar 23, 2006
  4. petro

    ObjectDataSource & Typed Dataset Can not update.

    petro, Sep 16, 2006, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    139
    petro
    Sep 16, 2006
  5. David Shorthouse

    Update query doesn't update table

    David Shorthouse, Jun 17, 2005, in forum: ASP General
    Replies:
    6
    Views:
    256
    David Shorthouse
    Jun 17, 2005
Loading...

Share This Page