Click here to Skip to main content
15,883,887 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
My webservice code is here .............


VB
<webmethod()> _
    <ScriptMethod(ResponseFormat:=ResponseFormat.Json)> _
    Public Function getConfigurationValueByKey(ByVal strKeyName As String) As String
        Dim sqlConnection As SqlConnection = New SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings("ConnStr").ConnectionString)
        sqlConnection.Open()
        Dim sqlCommand As SqlCommand = New SqlCommand("SELECT * FROM table1 WHERE column1 ='" + strKeyName + "';", sqlConnection)
        Dim sqlDataset As DataSet = New DataSet()
        Dim sqlDataAdapter As SqlDataAdapter = New SqlDataAdapter(sqlCommand)
 
        sqlDataAdapter.Fill(sqlDataset)
        sqlConnection.Close()
 
        Dim MArray()() As String = New String(sqlDataset.Tables(0).Rows.Count)() {}
        Dim i As Integer = 0
 
        For Each rs As DataRow In sqlDataset.Tables(0).Rows
            MArray(i) = New String() {rs("userid").ToString(), rs("name").ToString()}
            i = i + 1
        Next
 
        Dim js As JavaScriptSerializer = New JavaScriptSerializer()
        Dim sJSON As String = js.Serialize(MArray)
        Return sJSON
    End Function


I want to put userid and name fied to seperate text box .how to get that field from json.
Posted
Updated 11-Jul-12 11:40am
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900