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
diamond diamond
NA
133
55.5k
datatable does not have any data
Sep 8 2013 7:46 AM
Hi
I want to put the data from tables with some condition but dtdns doesn't give any output.
var Kelihos = dc.kv2s.OrderBy(p => p.ltime).Where(p => p.ltime >= paramTime && p.ltime < (paramTime + 300));
var Kelihosdns = dcdns.kv2dns;
DataTable dtdns = new DataTable("kelihos");
DataColumn dnscol1 = new DataColumn("saddr", typeof(string));
dtdns.Columns.Add(dnscol1);
DataColumn dnscol2 = new DataColumn("daddr", typeof(string));
dtdns.Columns.Add(dnscol2);
DataColumn dnscol3 = new DataColumn("dport", typeof(string));
dtdns.Columns.Add(dnscol3);
DataColumn dnscol4 = new DataColumn("dur", typeof(string));
dtdns.Columns.Add(dnscol4);
DataColumn dnscol5 = new DataColumn("state", typeof(string));
dtdns.Columns.Add(dnscol5);
DataColumn dnscol6 = new DataColumn("proto", typeof(string));
dtdns.Columns.Add(dnscol6);
DataColumn dnscol7 = new DataColumn("flgs", typeof(string));
dtdns.Columns.Add(dnscol7);
DataColumn dnscol8 = new DataColumn("id", typeof(string));
dtdns.Columns.Add(dnscol8);
dtdns.PrimaryKey = new DataColumn[] { dtdns.Columns["id"] };
int row1 = 0;
foreach (var item in Kelihos)
{
foreach(var k in Kelihosdns)
{
if ( item.saddr.ToString() == (k._Source_) && item.daddr.ToString() == (k._Destination_ ) && k._Info_.Contains("no such name"))
{
dtdns.Rows.Add();
dtdns.Rows[row1][0] = item.saddr.ToString().Trim();
dtdns.Rows[row1][1] = item.daddr.ToString().Trim();
dtdns.Rows[row1][2] = item.dport.ToString().Trim();
dtdns.Rows[row1][3] = item.dur.ToString().Trim();
dtdns.Rows[row1][4] = item.state.ToString().Trim();
dtdns.Rows[row1][5] = item.proto.ToString().Trim();
dtdns.Rows[row1][6] = item.flgs.ToString().Trim();
row1++;
}
}
}
Reply
Answers (
2
)
date n time picker value from database
C#.Net Message Box