Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Here is my having some bit of code for getting dataset values.</p> <p>For that first you have to create class object for that require table data. Like below </p> <pre><code>Class MyData Public ID As Integer Public Name As String Public ContactNo As String End Class </code></pre> <p>Now you need to define Structure for BasicOuputObject. object of this BasicOuputObject is sent over from server side to client.</p> <pre><code>Public Structure BasicOuputObject Dim status As String Dim errorMessage As String Dim strMessage As String Dim obj As Object End Structure </code></pre> <p>Now you have to use below function for getting datatable.</p> <pre><code>Public Sub GetMyData() Dim objOutput As New BasicOuputObject Dim objCommand As New SqlCommand Dim lstMyData As New List(Of MyData) Dim objMyData As MyData Dim objConn As New SqlConnection("Pass Connection String") objCommand.CommandText = "select ID ,Name ,ContactNo from Customers" objCommand.Connection = objConn objConn.Open() Dim m_rdrReader As SqlDataReader = objCommand.ExecuteReader() If m_rdrReader.HasRows Then While m_rdrReader.Read() objMyData = New MyData objMyData.ID = m_rdrReader(0) objMyData.Name = m_rdrReader(1) objMyData.ContactNo = m_rdrReader(2) lstMyData.Add(objMyData) End While End If m_rdrReader.Close() m_objConn.Close() objOutput.errorMessage = "" objOutput.obj = lstMyData objOutput.strMessage = "success" Dim objSerialiser As New System.Web.Script.Serialization.JavaScriptSerializer HttpContext.Current.Response.Write(objSerialiser.Serialize(objOutput)) HttpContext.Current.Response.End() End Sub End Class </code></pre> <p>Now modify javascript as below. use can use any machnism for calling above function from the handler.</p> <pre><code>function abc() { $.get('\HandlerResetPass.ashx?id=' + $('#txtUserId').val() + '&amp;lbl=' + $('#lblPasswo').val(), callback); function callback(data) { if (data.status == "success") { for (var row, i = 0; row = data.obj[i]; i++) { //Create the row strings using the CreateAddModelRowString function // Process row var for as per usage. } } else { alert('ID doesn\'t exist try again..!') return false; } } } </code></pre> <p>Hope this will help you. happy coding....</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload