TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
David Moore
NA
1
0
Strong Typed DataTables and Calculations.
Feb 13 2008 5:08 PM
I am in the process of converting everything over from inline SQL to a DAL using strong typed datatables. The problem I am running into is needing to add custom columns and values to these datatables on the fly before I bind them to a grid.
An example would be wanting to add a 'color' field to a datable that I use to change the color of text in a specific field in a datagrid. Currently I do this by adding a 'color' column to my datatable and when I pull data into the datatable from the sql server I use a foreach loop and run my calculations for each row and then add the value into that column.
e.g.
dt.Columns.Add(new DataColumn("itemColor", typeof(string)));
foreach (DataRow dirRow in ds.Tables[0].Rows)
{
if (dirRow["STATUS_ID"].ToString() == "1")
{
dr[8] = "red";
}
else if (dirRow["STATUS_ID"].ToString() == "2")
{
dr[8] = "blue";
}
}
Is there a way I can replicate this behavior with strong typed dataTables?
Thanks in advance.
Reply
Answers (
0
)
convert wav 8k 8bit to wav 16k
Hello, i need help with derived classes