This is a migrated thread and some comments may be shown as answers.

OpenAccess datasource and null values

1 Answer 88 Views
Development (API, general questions)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Jonathan
Top achievements
Rank 1
Jonathan asked on 29 Sep 2011, 08:07 AM
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!

Jonathan


1 Answer, 1 is accepted

Sort by
0
Damyan Bogoev
Telerik team
answered on 30 Sep 2011, 02:55 PM
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 >>

Tags
Development (API, general questions)
Asked by
Jonathan
Top achievements
Rank 1
Answers by
Damyan Bogoev
Telerik team
Share this question
or