Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesSqlDataProvider and Date valuesSqlDataProvider and Date values
Previous
 
Next
New Post
11/3/2011 10:25 AM
 
Hi,
I'm facing an issue with date culture conversion (probably), but I don't know if i'm not seeing the obvious or...
In my SqlDataProvider I have two Sub-s - one for adding data and the other one for updating. The calls are:

    SqlHelper.ExecuteNonQuery(ConnectionString, GetFullyQualifiedName("mySprocAdd"), DateFrom, DateTo, Description)
and
    SqlHelper.ExecuteNonQuery(ConnectionString, GetFullyQualifiedName("mySprocUpd"), ID, DateFrom, DateTo, Description)

The adding works fine, the update des not. So, the date format in Croatia is dd.mm.yyyy and the format in DNN for hr-HR is dd.mm.yyyy. (notice the dot in the end of the year part). So, when i execute the sproc through SQL Management Console with the parameters from DNN it returns an error for the date formatting. When I remove the dot behind the year everything works fine. What I don't understand is why the adding records through DNN works fine and the updating not? I'm not doing any format changes anywhere in the code.

Any ideas anyone.

Thanks
 
New Post
11/4/2011 5:21 AM
 
..me again.

now, for testing purposes, I've tried sending the date to the sproc as a string and in the sproc convert it again to smalldatetime format.

So, I'm sending this
    Dim localDateFrom As String = Format(DateFrom, "yyyy-mm-dd hh:mm")

The sproc looks like
...
UPDATE [dbo].[myTable]
   SET [DateFrom] = Convert(smalldatetime, @DateFrom,20) ,[DateTo] = Convert(smalldatetime, @DateTo,20)
  ....

And the error I'm getting is:

DefaultDataProvider
: DotNetNuke.Data.SqlDataProvider, DotNetNuke.SqlDataProvider
ExceptionGUID: c6cb54d0-0184-4917-9904-03c8c3b185db
InnerException: Conversion failed when converting character string to smalldatetime data type.
FileName:
FileLineNumber: 0
FileColumnNumber: 0
Method: System.Data.SqlClient.SqlConnection.


The problem is not in the SQL server as when you try this:

Declare @SQLQuery AS nvarchar(max)
set @SQLQuery ='2011-11-17 16:20'
print convert(smalldatetime,@SQLQuery ,20)

You will get

Nov 17 2011 4:20PM

I'm just stuck here. No more ideas.
 
New Post
11/4/2011 8:50 AM
 
well, after some debuging (and peeking to others code) I've started to use the DateTime format instead of Date in vb and smalldatetime in sql server and now everything works.

Maybe thie experience will help someone...
 
Previous
 
Next
HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesSqlDataProvider and Date valuesSqlDataProvider and Date values


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out