Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Participant
1266 Points
330 Posts
May 06, 2011 09:43 AM|LINK
Hi,
write your method as follows if you have no rows in your database it will automatically returns all columns with zero rows
SqlConnection cn = new SqlConnection("Data Source=.;database=NorthWind;user id=sa;password=sa@123"); [OperationContract] public DataSet GetData() { DataSet ds = new DataSet(); SqlDataAdapter da = new SqlDataAdapter("select * from Emp", cn); da.Fill(ds, "Emp"); return ds; }
and calling from client as follows
ServiceRef.Service1Client cleint = new ServiceRef.Service1Client(); DataSet ds = cleint.GetData();
Hope it will solve your problem.
Please mark as answer if post is solved your problem
Thanks
ganaparthi
Participant
1266 Points
330 Posts
Re: can i return null object (dataset) from a WCF webservice to the apsx page in .net 3.5 framewo...
May 06, 2011 09:43 AM|LINK
Hi,
write your method as follows if you have no rows in your database it will automatically returns all columns with zero rows
SqlConnection cn = new SqlConnection("Data Source=.;database=NorthWind;user id=sa;password=sa@123"); [OperationContract] public DataSet GetData() { DataSet ds = new DataSet(); SqlDataAdapter da = new SqlDataAdapter("select * from Emp", cn); da.Fill(ds, "Emp"); return ds; }and calling from client as follows
ServiceRef.Service1Client cleint = new ServiceRef.Service1Client(); DataSet ds = cleint.GetData();Hope it will solve your problem.
Please mark as answer if post is solved your problem
Thanks
Srinivas Ganaparthi,
'All things are difficult before they are easy'
My Blog