Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
C# ADO Executing Stored Procedure Problem
Message
From
18/01/2009 13:47:46
 
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Miscellaneous
Thread ID:
01374697
Message ID:
01374814
Views:
16
>I don't understand how ADO can make changes to the underlying table. I mean, in the resulting DS, assume I change the value of
>ModuleTypeKey, which is in a JOINed table. If I then call Update, how does ADO know which table to put the changes in?


>It's amazing how well my code works when I code it right! Thanks.

You're welcome! =0)

>A related question.

>I don't understand how ADO can make changes to the underlying table. I mean, in the resulting DS, assume I change the value of
>ModuleTypeKey, which is in a JOINed table. If I then call Update, how does ADO know which table to put the changes in?


I don't think it *can* know it. Which is why I don't use the Update ... I roll my own (basically, spin through every changed row in the table you want to update, and for each of those rows set parameters and ExecuteNonQuery. It's basically what the Update does behind the scenes, but you obviously have more control over it). We've have a set of "parameter" methods that do things like automatically set parameters.

~~Bonnie


>
>A related question. Here's the sproc I tested with:
>
>
>SELECT	prj.ProjectKey, prj.ProjectName, prj.TotalHours, prj.PercentDone, 
>		prj.PriorityKey, pri.PriorityName, 
>		prj.StatusKey, pst.PrjStatusCodeName,
>		prj.ManagerKey, emp.FirstName + ' ' + emp.LastName AS AssignedTo, prj.EstEndDate,
>		mod.ModuleKey, mod.ModuleName, mod.ModuleCode, mod.ModuleTypeKey, mt.ModuleTypeName,
>		tsk.TaskKey, tsk.TaskName, tsk.TotalHours AS TaskTotalHours, tsk.PercentDone AS TaskPercentDone, 
>		tsk.PriorityKey AS TaskPriorityKey, tpr.PriorityName AS TaskPriority,
>		tsk.AssignedEmpKey AS TaskAssignedToKey, temp.FirstName + ' ' + temp.LastName AS TaskAssignedTo
>	FROM bm_Projects prj
>	FULL JOIN bm_Employees emp ON emp.EmployeeKey = prj.ManagerKey
>	FULL JOIN bm_Priorities pri ON pri.PriorityKey = prj.PriorityKey
>	FULL JOIN bm_ProjectStatusCodes pst ON pst.PrjStatusCodeKey = prj.StatusKey
>	FULL JOIN bm_Modules mod ON mod.ProjectKey = prj.ProjectKey
>	FULL JOIN bm_ModuleTypes mt ON mt.ModuleTypeKey = mod.ModuleTypeKey
>	FULL JOIN bm_Tasks tsk ON tsk.ModuleKey = mod.ModuleKey
>	FULL JOIN bm_Priorities tpr ON tpr.PriorityKey = tsk.PriorityKey
>	FULL JOIN bm_Employees temp ON temp.EmployeeKey = tsk.AssignedEmpKey
>	WHERE prj.AppKey = @AppKey
>
>
>I don't understand how ADO can make changes to the underlying table. I mean, in the resulting DS, assume I change the value of
>ModuleTypeKey, which is in a JOINed table. If I then call Update, how does ADO know which table to put the changes in? If I had to guess, I would say that it parses the query and stores all the table name and other info, but this all seems really complicated.
>
>I guess I'm wondering if you could shed a bit of light on this.
>
>Thanks
>
>
>
>
>>Hi Kevin,
>>
>>You've left out the name of the parameter, which I assume you want to be the same as the column name. You need to add something like this to your ExecuteStoredProc class:
>>
>>
>>oParam.ParameterName = "@" +  oColParam.sSrcColName;
>>
>>
>>~~Bonnie
>>
>>
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform