Question on MS VS and .Net. I need to write a WinForms database application. The constructor created the xsd database schema. Variable values ​​are typed. In the automatically created Tableadapter.Insert there are parameters with data types, for example system.int32 in which you need to insert NULL (DBNull.Value) or Nothing. In the database, these fields can be Null.

How to insert a null without resorting to direct SQL commands? I want to use insert with typed parameters. Sorry, if something messed up in programming maker)

I read the forums, they write there that this is a longtime glitch xsd.exe, which does not know how to set nullable data types to parameters.

    1 answer 1

    The problem was solved by type conversion for all query parameters.

    IIf(IsNothing(var1),Nothing,CInt(var1)) IIf(IsNothing(var2),Nothing,CSng(var2)) 

    For Excel time, I used DateTime.FromOADate (var3), also helped speed up the program by combining tableadapter.insert into a transaction. That is, it seems that the described problem was not, and there was no proper conversion.