Android Question parameters problem

Makumbi

Well-Known Member
Licensed User
please help iam try to pass these paramenters
B4X:
Dim act As String = 05-07152
    Dim from As String = 22/01/2018
    Dim tos As String = 22/12/2018
    'j.Download("http://192.168.1.239/Generic_Handler_JSON/HandlerVBStatement.ashx?customerId=" & 05-07152 & "&code=" & 22/01/2018 & "&code2=" & 22/12/2018)
    j.Download("http://192.168.1.239/Generic_Handler_JSON/HandlerVBStatement.ashx?customerId=" & act & "&code=" & from & "&code2=" & tos)

B4X:
<%@ WebHandler Language="VB" Class="HandlerVB" %>

Imports System
Imports System.Web
Imports System.Data
Imports System.Configuration
Imports System.Data.SqlClient
Imports System.Collections.Generic
Imports System.Web.Script.Serialization

Public Class HandlerVB : Implements IHttpHandler

    Public Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest
        Dim callback As String = context.Request.QueryString("callback")
        Dim customerId As String = context.Request.QueryString("customerId")
        Dim bcode As String = context.Request.QueryString("code")
        Dim bcode2 As String = context.Request.QueryString("code2")

        ' Dim strDate As DateTime


        ' strDate = DateTime.Parse(bcode, System.Globalization.CultureInfo.CreateSpecificCulture("en-GB").DateTimeFormat)
        ' Dim formatInfo As New System.Globalization.DateTimeFormatInfo()
        '  formatInfo.LongDatePattern = "dd/MM/yyyy"


        '  Dim strStartDate As String = strDate.ToString("dd/MM/yyyy", formatInfo)

        Dim json As String = Me.GetCustomersJSON(customerId, bcode, bcode2)
        If Not String.IsNullOrEmpty(callback) Then
            json = String.Format("{0}({1});", callback, json)
        End If

        context.Response.ContentType = "text/json"
        context.Response.Write(json)
    End Sub

    Private Function GetCustomersJSON(customerId As String, bcode As String, bcode2 As String) As String
        Dim customers As New List(Of Object)()
        Dim bc As String = 0
        Using conn As New SqlConnection()
            conn.ConnectionString = ConfigurationManager.ConnectionStrings("constr").ConnectionString
            Using cmd As New SqlCommand()
                cmd.CommandType = CommandType.StoredProcedure
                cmd.CommandText = "glsttV4"
                cmd.Parameters.Add("@act", SqlDbType.NVarChar).Value = customerId
                cmd.Parameters.Add("@f", SqlDbType.NVarChar).Value = bcode
                cmd.Parameters.Add("@t", SqlDbType.NVarChar).Value = bcode2
                cmd.Connection = conn
                conn.Open()
                cmd.ExecuteReader()
            End Using
            conn.Close()
        End Using


        Using conn As New SqlConnection()
            conn.ConnectionString = ConfigurationManager.ConnectionStrings("constr").ConnectionString
            Using cmd As New SqlCommand()
                cmd.CommandType = CommandType.StoredProcedure
                cmd.CommandText = "Runningbalance"
                cmd.Connection = conn
                conn.Open()
                cmd.ExecuteReader()
            End Using
            conn.Close()
        End Using
        Return False

    End Function

    Public ReadOnly Property IsReusable() As Boolean Implements IHttpHandler.IsReusable
        Get
            Return False
        End Get
    End Property



End Class

but after i get this error

B4X:
Syntax error converting datetime from character string.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…