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
Dinesh Santhalingam
NA
737
368.5k
Data table to array and return array
Dec 28 2016 1:10 AM
[System.Web.Services.WebMethod]
public void loaddata()
string
sql
=
"SELECT Name,Time,Inuse FROM table4"
;
using (SqlConnection
Connection
=
new
SqlConnection((@"Data Source)))
{
using (SqlCommand
myCommand
=
new
SqlCommand(sql, Connection))
{
Connection.Open();
using (SqlDataReader
myReader
=
myCommand
.ExecuteReader())
{
DataTable
dt
=
new
DataTable();
dt.Load(myReader);
Connection.Close();
DataView
dv
=
new
DataView(dt);
dv.RowFilter
= (("
Name
=
'ACVX'
"));
var
tableEnumerable
=
dv
.ToTable().AsEnumerable();
var
tableArray
=
tableEnumerable
.ToArray();
return tableArray ;//Error
}
}
}
}
I Want to load my datatable into an Var Array and Return the array .suggest some ideas to do my TASK..
Reply
Answers (
3
)
datarow to array from data table
Window command creating a dynamic batch script