s
Contact Login Register
h M

Data Springs Modules Community Questions & Answers

Forms not working with SQL Datatype

Hi, I'm having issues with DynamicForms and datatypes in SQL. In my form I have multiple textbox fields where the user enters numbers. In my database table I have the corresponding columns' data types set as decimal(5,2) but the form won't store its values to the database. 

However, when I change those datatypes to nvarchar, the form submits just fine and the information is stored in the database. 

The weird part is that the form submits fine if I change only one of the columns back to a decimal datatype. But if I change any of the other columns, the form won't store its values to the database.

I need for these fields to be a numeric type because I have calculation that need to done with their values.  

Is there anyway to solve this issue?
asked 6/19/2014
23

1 Answer

This answer has been selected by the question author as the best answer. Hello,

I would always recommend storing data as nvarchar if you have the choice. Unless it's a date, identity column, etc...

So perhaps you can do a quick conversion on your token when injecting into your SQL table.

------------------------------------------------

INSERT INTO TABLE
(
COLUMN1,
...
...
)
VALUES
(
Convert(varchar,cast('$(VALUE1)' as money),1),
...
...
)

------------------------------------------------


Let me know if this assists you in storing the data.

-Ryan
answered 6/20/2014 Rbakerink 160
Rbakerink
  • Thank you so much! This solution worked perfectly! - 6/20/2014

  • But now I have another problem now. The values that I did a conversion on cause the form to NOT to submit to the database when their fields in the from are left blank. However, If I add values to these fields in the form, the form submits it's values to the database just fine. - 6/20/2014

Your Answer

In order to provide an answer to this question, you must Login

I am flagging this question because...

10 inform moderator flags remaining

I am deleting this question because...

I am flagging this answer because...

10 inform moderator flags remaining

Flagging a Post

You have already flagged this post. Clicking "Remove Flag" below will remove your flag, thus reducing the count by one as well.

I am deleting this answer because...

Looking for a DNN Module?

If you’ve used Data Springs modules before, you know how easy they are to install and use. We have built each individual module in our collection with integration in mind, so when you opt for Collection 7.0 you’ll be able to install our entire toolbox quickly and start putting it to work for your business today.Yes, in the blink of an eye you will arrive on the scene like a Superhero!

Data Springs has long been recognized as a leader in the DotNetNuke (DNN) community through hard work, integrity, and commitment. We’ve helped thousands of people POWER UP their website and our Collection 7.0 will do the same for you.

You deserve more than just an average website. You deserve a MACHINE!

Enter your email below AND grab your spot in our big giveaway!

The winner will receive the entire Data Springs Collection 7.0 - Designed to get your website up and running like a DNN superhero (spandex not included).

Subscribe