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
Riddhi Valecha
442
3.3k
415.1k
Bind GridView From WCF Service Datatable
Sep 27 2017 10:27 AM
Dear all,
I have made a WCF Project.
In the interface -
[OperationContract]
string GetConnectionString()
[OperationContract]
Boolean CheckIfConnectionIsOpen()
[OperationContract]
Datatable GetUsersList
In Service Class -
public string GetConnectionString()
{
return ConfigurationManager.ConnectionString["conn"].ToString();
}
public Boolean CheckIfConnectionIsOpen()
{
con.ConnectionString = GetConnectionString();
con.Open();
}
public datatable GetUsersList()
{
Datatable dt = new datatable;
cmd = new SQLCommand();
cmd.Text= "SP_LOADUSERS";
adp = new SQLDataadapter();
adp.fill(dt);
return dt;
}
----------
Now I added a new project -ASP.NET Empty Project
I added Service Reference
Code -
Service1.client client = new Service1.client();
Datatable tt = new Datatable();
tt = client.GetUsersList();
grddata.datasource =tt;
grddata.Databind();
---------
When I debug the code - the break point runs only till the method - client.GetUsersList().
The two line - grddata.datasource =tt; and grddata.Databind(); - are not getting executed.
----------
Reply
Answers (
2
)
java rest web service using post
Object reference not set to an instance of an object.