Re: TableAdapter Designer generates weird update and delete proced by William
William
Mon Oct 03 11:28:26 CDT 2005
Which version of ADO.NET are you working with? I suggest using the September
CTP. The version of SQL Server you're accessing is also important--again the
SQL Server 2005 September CTP matches the VS September CTP.
--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
www.betav.com/blog/billva
www.betav.com
www.sqlreportingservices.net
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
"Mirronelli" <Mirronelli@discussions.microsoft.com> wrote in message
news:6F4CD177-3888-4C23-AE81-628619B5D383@microsoft.com...
>I do understand why the are sending the parameter and I think that it has
> sense.
> What I object is the type of the parameter which is alway used for values
> (1|0) but is declared as the column's underlying type.
>
> Consider this example:
> Table has a nullable column 'Name' and and identity column ID.
>
> The generated SP has parameters:
> - @ID int,
> - @Name varchar(50)
> - @IsNameNull varchar(50) <------- here
>
> The generated TableAdapter has parameters:
> - @ID int
> - @Name string
> - @IsNameNull int <------- here
>
> See the difference in TableAdapter parameters and SP parameters.
> What I think is that thay have forgotten to change the @IsColumnNull
> parameter to int in SP. I hope thay can still fix it till RTM.
>
> I am not a beta member so this is the only place I can post bugs and hope
> they'll solve it for the good of us and the world. :-)
>
> Due to the graciousness of SQL server and its implicit casts this works
> but
> not the most efficient way it could.
>
> "William (Bill) Vaughn" wrote:
>
>> They are including that test to deal with NULL and other parameter
>> issues.
>> We've discussed this before (and we will again) so see the archives. It's
>> simply another reason to consider rolling your own procedures.
>>
>> --
>> ____________________________________
>> William (Bill) Vaughn
>> Author, Mentor, Consultant
>> Microsoft MVP
>> www.betav.com/blog/billva
>> www.betav.com
>> www.sqlreportingservices.net
>> Please reply only to the newsgroup so that others can benefit.
>> This posting is provided "AS IS" with no warranties, and confers no
>> rights.
>> __________________________________
>>
>>
>> "Mirronelli" <Mirronelli@discussions.microsoft.com> wrote in message
>> news:6199E097-CCF5-4B73-AD05-977B6C7E1527@microsoft.com...
>> > Hi,
>> >
>> > I am impressed by the work you have done to simplify creation of DAL
>> > components.
>> > I especially like TableAdapters.
>> >
>> > However, I have found out that when you generate a TableAdapter in the
>> > TableAdapter Designer it creates a bit weird update and delete (SQL)
>> > procedures.
>> > Whenever a collumn is nullable it generates special parameters to
>> > signal
>> > that a given collumn should be null. It has a name which looks like
>> > this:
>> > @IsColumnNameNull but its type is the same as the type of the
>> > underlying
>> > column , instead of just making it of type int.
>> >
>> > The generated adapter code (C#) declares it as of type int, which makes
>> > it
>> > all work.
>> > But this way the SQL Server must convert the parameter value to int (0
>> > or
>> > 1)
>> > because it compares it to 1 or 0. I think this is a bit worhtless.
>> >
>>
>>
>>