TableAdapter Designer generates weird update and delete procedures

G

Guest

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.
 
W

William \(Bill\) Vaughn

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.
__________________________________
 
G

Guest

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.
 
W

William \(Bill\) Vaughn

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.
__________________________________
 
G

Guest

Both ADO.NET and SQL Server are September CTP

William (Bill) Vaughn said:
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.
__________________________________
 

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

Top