ObjectDataSource and DataSet Update Query Creation

H

Hurricane

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
 

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

Members online

Forum statistics

Threads
473,773
Messages
2,569,594
Members
45,124
Latest member
JuniorPell
Top