| View previous topic :: View next topic |
| Author |
Message |
vamsy
Joined: 21 Aug 2007 Posts: 60
|
Posted: Mon Mar 10, 2008 7:00 am Post subject: ASP.Net GridView data binding using web service with c# |
|
|
Hi experts,
i want to bind GridView with the help of web service. can any one let me know how to create web service for this application and how to consume it.
thanking you in advance........please let me know in detail.
with regards,
chandu.... |
|
| Back to top |
|
 |
muralikrishna
Joined: 21 Aug 2007 Posts: 36
|
Posted: Mon Mar 10, 2008 7:10 am Post subject: |
|
|
hi,
I got the solution for your query. here is the following code snippet for database interaction with the help of web service and populating data from data base.
using System;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
[WebService(Namespace = "http://localhost:3694/InsertService/Service.asmx?WSDL")]
[WebMethod(Description = "Selcect By Employee First Name", BufferResponse = true)]
public DataSet Select(string FirstName)
{
SqlCommand Selectcmd = new SqlCommand("select * from employees where firstname='" + FirstName + "'", con);
DataSet ds = new DataSet();
SqlDataAdapter da = new SqlDataAdapter(Selectcmd);
da.Fill(ds);
return ds;
}
in the above few lines of code Web Method Select will returns a data set. and this will give the data about employees by taking first name as a input string.
enjoy the article.... |
|
| Back to top |
|
 |
|