Showing posts with label object. Show all posts
Showing posts with label object. Show all posts

Wednesday, March 21, 2012

DNN DAL SqlDataProvider Passing NULL to SQL Stored Procedure

Hello,

I'm trying to pass a null object to a stored procedure to update a SQL Table boolean field with a null value. My SQL Table boolean column allows nulls.

I'm using an InfoObject which has several properties all corresponding to fields in the SQL Table. One of those fields is a boolean. I create an instance of the InfoObject in my code and assigns values to the various properties. The boolean property in question (call it InfoOjbect.BooleanProperty) is not assigned anything. I then call my StoredProcedure passing the InfoObject to it (using the DotNetNuke DAL architecture) and the final result is the Table's boolean column is populated with a 0 and not a NULL. If I explicitly define the InfoObject.BooleanProperty = null.nullboolean before passing it to the Stored Procedure, the same thing happens. How do I pass a null to the SQL database for a boolean field? I've tried making InfoObject.BooleanProperty = dbnull.value but it won't let me do this saying "dbnull cannot be converted to a boolean." Do I have to explicitly create my InfoObject properties to allow for a null to be assigned to it?

Any help would be greatly appreciated. I'm using the DotNetNuke DAL architecture passing my InfoObject through a dataprovider to the sqldataprovider which calls the SQL Stored Procedure to add the new record to the Table.

Thanks in advance for any help.Please help?!|||The issue was with my InfoObject construction. DNN Core Team provided the solution. You can see it athttp://www.dotnetnuke.com/Community/ForumsDotNetNuke/tabid/795/forumid/118/threadid/41618/threadpage/3/scope/posts/Default.aspx

Friday, February 24, 2012

Distribution Agent failed with error

My Snapshot was successful but an error occurs when I try to run the
distribution agent.
Invalid object name 'PA_COLUMN_NAMES1_V'.
(Source: ADMIN1SERVER\ADMINSQL (Data source); Error number: 208)
------
Unable to replicate a view or function because the referenced objects or
columns are not present on the Subscriber.
(Source: AGENT (Agent); Error number: 00000)
Any help here would be appreciated,
Rick Rushing
"Rick Rushing" schrieb:

> My Snapshot was successful but an error occurs when I try to run the
> distribution agent.
> Invalid object name 'PA_COLUMN_NAMES1_V'.
> (Source: ADMIN1SERVER\ADMINSQL (Data source); Error number: 208)
> ------
> Unable to replicate a view or function because the referenced objects or
> columns are not present on the Subscriber.
> (Source: AGENT (Agent); Error number: 00000)
> --
> Any help here would be appreciated,
> Rick Rushing
1. Check if the referenced table is part of the publication (if yes: try two
seperate publications: the first one includes the referenced table and the
second one includes the function).
2. Check the ownership of the objects (error 208 in replications often
appears if the owner of the objects in the publisher is not 'dbo'). The use
of a different owner than 'dbo' for the objects + the use of the rather
inflexible replication wizzards unfortunately is a little buggy
|||The view refers to either a table which isn't part of the publication, or
another view in which case the metadata doesn't reflect the dependencies.
AFAIK this error can't refer to a function or stored procedure, as both use
deferred name resolution, consequently the absence of dependant objects on
the subscriber at synchronization time is not an issue. You could use
logging to find out the objects causing dependancy problem. If it is between
views then you could try to fix it by refreshing the objects, assuming they
are all replicated together in the same publication. If it's a dependency
between the view and table, you could follow Christian's good advice and
make sure the table is also replicated - either the same publication, or
another which initializes before this one.
HTH,
Paul Ibison SQL Server MVP, www.replicationanswers.com
(recommended sql server 2000 replication book:
http://www.nwsu.com/0974973602p.html)