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

HomeHomeUsing DNN Platf...Using DNN Platf...Using Modules a...Using Modules a...updating records to a database using razor script / razor host moduleupdating records to a database using razor script / razor host module
Previous
 
Next
New Post
2/6/2014 4:40 PM
 

Is it possible to access the database to get and mainly update records?

Lets say I created a table with three fields (ID, Field1, Field2) in the dnn database (or a separate database if necessary). How do I write to this table? I used one of the razor script samples to create the input fields and submit button, but I don't know (if possible) how access the database to submit the user input to the table I created. And last but optional, how do I read from the table to display records.

I'm hoping this is possible through the razor host module and not necessary to create a module for it. Thanks in advance for any help I can get.

 
New Post
2/6/2014 6:38 PM
 
absolutely, see the documentation at http://www.microsoft.com/en-us/downlo... (you'll want to read the connectionstring from web.config). Another easy alternative (if you're using a recent version) is the module creator - create a new page, add a "module creator" module to it, fill in the values and a new module and test page will be created. You can now go to the module menu and select "develop" (If a host and on localhost) and use that to do some simply editing - this way you can reuse code from the platform without converting to razor

Buy the new Professional DNN7: Open Source .NET CMS Platform book Amazon US
 
New Post
2/6/2014 7:04 PM
 

Yes you could - but IMHO - with all the new built in 'create a module' templates as a part of the core in dnn 7.2x it is often less agro to just roll the same code you would have tried to create in razorscript into a module.

The nice thing about a module is that all your data access code is separated out into its own files - so one file for layout - one file for code - in razor its all buried in one file.

Westa

 
New Post
2/6/2014 8:18 PM
 
Thank you all for your help. I will definitely give the module creator a try first.
 
Previous
 
Next
HomeHomeUsing DNN Platf...Using DNN Platf...Using Modules a...Using Modules a...updating records to a database using razor script / razor host moduleupdating records to a database using razor script / razor host module


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