Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
CommandBuilder vs Stored Proc for updating
Message
 
 
To
26/01/2010 21:26:39
General information
Forum:
ASP.NET
Category:
ADO.NET
Environment versions
Environment:
C# 2.0
Miscellaneous
Thread ID:
01445437
Message ID:
01446127
Views:
38
Thank you, Bonnie. I understand now.

>
>You, as a developer, have control over how you set up your Stored Procs, so you'd need to have the Stored Proc's parameters in the order that the columns are specified in your DataSets, if you are using a database that only supports positional parameters (meaning, they *have* to be in a certain order, like I think VFP requires this ... not sure about VFP actually, so don't quote me on that <g>)
>
>If a database uses "positional parameters", then your Commands look like this (typically uses "?"):
>
>
>insert into MyTable (MyColumn1, MyColumn2) values (?, ?)
>
>
>whereas "named parameters" (like with SQLServer) would look like this:
>
>
>insert into MyTable (MyColumn1, MyColumn2) values (@MyColumn1, @MyColumn2)
>
>
>~~Bonnie
>
>
>>
>>>Hi Dmitry,
>>>
>>>>Coming back to your suggestion on how to write a stored procedure for updating database, I was wondering if you could, please, clarify something. In your blog III you have a method SetAllParameters() that iterates through columns of the table. How do you make sure that the order of parameters in the stored procedure match the order of parameters sent when executing stored procedure from DAL?
>>>
>>>SqlServer uses named parameters, not positional, so for SQL it doesn't matter what order they're created. For databases where positional parameters are used, then you're just going to have be careful. <g>
>>>
>>>~~Bonnie
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Previous
Reply
Map
View

Click here to load this message in the networking platform