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

ObjectDataSource and DataSet Update Query Creation

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

Apr 24 '07 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.