Below is an example I use to retrieve data. Basically you pass in an SQL statement and paramters and it will return an IRecordsReader. If you don't care about compatibility with other datasources such as mysql you can use any database technique you like. It's just asp.net
Cheers,
Richard
publicList<ContentValidationErrorView> GetAll()
{
List<ContentValidationErrorView> validationErrors = newList<ContentValidationErrorView>();
using (var reader = Application.SqlHelper.ExecuteReader("SELECT SEOAnalyzer_ValidationIssues.*,umbracoNode.Text AS DocumentTitle FROM SEOAnalyzer_ValidationIssues INNER JOIN umbracoNode ON SEOAnalyzer_ValidationIssues.DocumentID = umbracoNode.id WHERE Ignore = 0 and ItemType='content' order by documentTitle, ValidationComponentAlias"))
{
while (reader.Read())
{
validationErrors.Add(newContentValidationErrorView(reader.GetInt("IssueId"))
{
DocumentID = reader.GetString("DocumentID"),
DocumentTitle = reader.GetString("DocumentTitle"),
Ignore = reader.GetBoolean("Ignore"),
IssueAlias = reader.GetString("IssueAlias"),
ValidationComponentAlias = reader.GetString("ValidationComponentAlias"),
Item = reader.GetString("Item"),
ItemText = reader.GetString("ItemText")
}
);
}
}
return validationErrors;
}
I am not an advanced user of csharp, but I'm glad for your help.
I ended up with this and it is just what I needed
var reader = umbraco.BusinessLogic.Application.SqlHelper.ExecuteReader("SELECT * FROM jhName");
while (reader.Read())
{
Label1.Text += reader.GetString("Name");
}
if you have any more tips I would greatly appreciate it.
how to use SqlHelper and read table data
I want to read data from a custom table, from umbraco´s databace.
I am using a UserControl, csharp.
But I can figure this out, I have searched all day long.
I have found something about SqlHelper, but I can´t find documentation on this subject.
thank you,
- Johan
Hi Johan,
Below is an example I use to retrieve data. Basically you pass in an SQL statement and paramters and it will return an IRecordsReader. If you don't care about compatibility with other datasources such as mysql you can use any database technique you like. It's just asp.net
Cheers,
Richard
Thank you Richard
I am not an advanced user of csharp, but I'm glad for your help.
I ended up with this and it is just what I needed
if you have any more tips I would greatly appreciate it.
/Johan
If others lack information about working a bit with Umbraco database
/Johan
visite thw WebSite:http://www.dbhelper.org/sqlhelper/,download the code package.
how to select all and display in gridview control
is working on a reply...