Steps To Follow:
1. File -> New Website ->Asp.net Webservice ->Click
2. In S.E ->App_code->Service.vb-><webmethod>_
3. Create Another Function related for ur database access. Just an example follows:
Public Function getviews() As DataSet
Dim con As New SqlConnection("server=.;database=sample;uid=sa;pwd=csbdu;")
Dim da As New SqlDataAdapter("select * from emp", con)
Dim ds As New DataSet()
da.Fill(ds, "emp")
Return ds
End Function
Before that Import Namespaces like Imports System.Data,Imports System.Data.Sqlclient
4. Press F5 or Debug ur Webservice. U have Two methods like HelloWorld and Getviews:
5. Copy that URL and Paste into newly create Web application.
How to paste in WebApplication:
6. File -> New Website->click.
7. In S.E->rightClick->Add Webreference->Click
8. Paste that URL in Corresponding Location. Press Add Reference. Localhost 3 files to generated. files like .disco,.discomap,.wsdl.
9. In Default.aspx page add ur controls like gridview, multiview and so on related for ur local webservice.
In my example, i follow the gridview control. In Default.aspx fix gridview and Button control.
While u clicking the button control,enter the code follows
Dim obj As New Mydbservice.Service
GridView1.DataSource = obj.getviews
GridView1.DataBind()
9. Press F5 or Debug ur Web Application.
Hope u will get .....
No comments:
Post a Comment
Confidence may not bring success but
It gives a heart to face any challange..!