OpenAccess datasource and null values

Thread is closed for posting
2 posts, 0 answers
  1. Jonathan Simmons
    Jonathan Simmons avatar
    110 posts
    Member since:
    Jun 2005

    Posted 29 Sep 2011 Link to this post

    Hello, I am using a grid bound to and OA datasource and have set AllowUpdate, AllowInsert and AllowDelete all to true as this is a very simple grid providing a management of a reference table in the database. Nothing fancy required, although I have created an EditForm template to make things a little neater and to display a little help text on the form. The grid is also set to allow automatic inserts, updates and deletes.

    The entity model defines the property JobTitle as nullable (as does the database) but I cannot get the OA datasource to pass null in the insert statement when the JobTitle textbox is left blank.

    This is what is hitting the database:

    declare @p1 int
    set @p1=6
    exec sp_prepexec @p1 output,N'@p0 nvarchar(6),@p1 nvarchar(8),@p2 nvarchar(1)',N'INSERT INTO [Chair] ([chairFirstName], [chairLastName], [jobTitle]) VALUES (@p0, @p1, @p2)
    select scope_identity()',@p0=N'Secret',@p1=N'Squirrel',@p2=N''
    select @p1

    I'm sure there is a simple way of doing this, but need a little inspiration please!


  2. Damyan Bogoev
    Damyan Bogoev avatar
    581 posts

    Posted 30 Sep 2011 Link to this post

    Hello Jonathan Simmons,

      I am afraid that there is no such setting in the OpenAccessDataSource. Actually you do not need to handle this scenario explicitly. When the textbox is left blank, after executing the insert statement the value will be stored as NULL in the database.
      If any other questions arise, do not hesitate to contact us.

    Best wishes,
    Damyan Bogoev
    the Telerik team

    Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's SQL Server Community Awards. We are competing in TWO categories and every vote counts! VOTE for Telerik NOW >>

Back to Top