What version of umbraco are you using? Also is the database a separate database from the umbraco database or is it a bunch of tables you want to query in the umbraco database that you have created?
In that case you can make use of petapoco which is the data layer umbraco uses. More information about peta poco here and to use in umbraco you can do things like:
Database Db = ApplicationContext.Current.DatabaseContext.Database;
public bool InsertRecordInDb(int questionId, int nodeId, bool answer, Guid recordId)
{
var surveyEntry = new SurveyAnswer
{
ContourId = recordId,
NodeId = nodeId,
Answer = answer,
QuestionId = questionId,
DateOfAnswer = DateTime.Now
};
try
{
Db.Insert(surveyEntry);
First create a blank databsase at your local machine or server where you want to create database
when you run the site through IIS there will be first step where you set the user daetails and also you will find 2 buttons: Continue another Customise
click on customise button in next screen you will find option to set database details.
Custom Control with Data Base
Hi All,
I am new in Umbraco. I want to create custom contol for umbraco with database connectivity.
I have searched this on google but not found any thing regarding database connectivity.
Please suggest...
Rahul,
What version of umbraco are you using? Also is the database a separate database from the umbraco database or is it a bunch of tables you want to query in the umbraco database that you have created?
Regards
Ismail
Ismail
I am using Umbraco version 6.1.6. I have created tables in the Umbraco database.
Rahul,
In that case you can make use of petapoco which is the data layer umbraco uses. More information about peta poco here and to use in umbraco you can do things like:
public bool InsertRecordInDb(int questionId, int nodeId, bool answer, Guid recordId) {
var surveyEntry = new SurveyAnswer { ContourId = recordId, NodeId = nodeId, Answer = answer, QuestionId = questionId, DateOfAnswer = DateTime.Now }; try { Db.Insert(surveyEntry);
and my class surveyanswer looks like:
So my surveyclass maps to survey table in database.
Regards
Ismail
Thanks a lot Ismail
I will try your solution and let you know if any help needed for the same.....
Hi,
I am new in umbraco 7..... How to create Data base for umbraco 7 version.....
i installed umbraco 7 using IIS.... but i didnot get the database details....
Kindly provide the database details for Umbraco 7
First create a blank databsase at your local machine or server where you want to create database
when you run the site through IIS there will be first step where you set the user daetails and also you will find 2 buttons: Continue another Customise
click on customise button in next screen you will find option to set database details.
is working on a reply...