jQWidgets Forums
jQuery UI Widgets › Forums › Chart › How to assign parameter for a vb.net function
This topic contains 9 replies, has 2 voices, and was last updated by thaptu 12 years, 10 months ago.
-
Author
-
Here’s my code for request xml data
javascript
var source = { datatype: "xml", datafields: [
{ name: 'thang' },
{ name: 'doanhthu' },
{ name: 'chiphi' }
],
//type: "POST",
root: "Items",
record: "Item",
async: false, url: 'smbcClient.aspx/ViewChart', processData: true, data:{timeID: "013"}
}
var dataAdapter = new $.jqx.dataAdapter(source, { contentType: 'application/json; charset=utf-8' });
vb.net
_
Public Shared Function ViewChart(ByVal timeID As String) As String
Dim dsChart101 As New DataSet
Dim dAcc As String = dsForm.Tables(0).Rows(0)("d_acc")
Dim cAcc As String = dsForm.Tables(0).Rows(0)("c_acc")
Try
connection.ConnectionString = settings.ConnectionString.Replace("%Database", database).Replace("%UserID", userID.ToString.Trim)
connection.Open()
command.Connection = connection
command.CommandText = "EXEC [fs_BI101] '" + timeID + "', '', '" + cAcc + "', '" + dAcc + "', 1, " + userID.ToString + ", " + (IIf(Admin, 1, 0)).ToString
adapters.SelectCommand = command
adapters.Fill(dsChart101)
connection.Close()
Catch ex As Exception
End Try
Return XMLSchema(dsChart101)
End Function
The above code is not working.
The working code is :
javascript
var source = { datatype: "xml", datafields: [
{ name: 'thang' },
{ name: 'doanhthu' },
{ name: 'chiphi' }
],
//type: "POST",
root: "Items",
record: "Item",
async: false, url: 'smbcClient.aspx/ViewChart'
}
var dataAdapter = new $.jqx.dataAdapter(source, { contentType: 'application/json; charset=utf-8' });vb.net
_
Public Shared Function ViewChart() As String
Dim dsChart101 As New DataSet
Dim dAcc As String = dsForm.Tables(0).Rows(0)("d_acc")
Dim cAcc As String = dsForm.Tables(0).Rows(0)("c_acc")
Try
connection.ConnectionString = settings.ConnectionString.Replace("%Database", database).Replace("%UserID", userID.ToString.Trim)
connection.Open()
command.Connection = connection
command.CommandText = "EXEC [fs_BI101] '013', '', '" + cAcc + "', '" + dAcc + "', 1, " + userID.ToString + ", " + (IIf(Admin, 1, 0)).ToString
adapters.SelectCommand = command
adapters.Fill(dsChart101)
connection.Close()
Catch ex As Exception
End Try
Return XMLSchema(dsChart101)
End Function
My question is : how can I assign parameter : “timeID” for ViewChart() function in javascript code ?
Thank you very much !
Have you tried passing the data to the server in this format:
data:{“timeID”: “013”} instead of data:{timeID: “013”}
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comWhen i use: data:{“timeID”: “013″}
{“Message”:”Invalid web service call, missing value for parameter: \u0027timeID\u0027.”,”StackTrace”:” at System.Web.Script.Services.WebServiceMethodData.CallMethod(Object target, IDictionary`2 parameters)\r\n at System.Web.Script.Services.WebServiceMethodData.CallMethodFromRawParams(Object target, IDictionary`2 parameters)\r\n at System.Web.Script.Services.RestHandler.InvokeMethod(HttpContext context, WebServiceMethodData methodData, IDictionary`2 rawParams)\r\n at System.Web.Script.Services.RestHandler.ExecuteWebServiceCall(HttpContext context, WebServiceMethodData methodData)”,”ExceptionType”:”System.InvalidOperationException”}
Thanks.
Hi thaptu,
I suggest you to take a look at this help topic which describes how to send additional params via ajax call: jquery-grid-extra-http-variables.htm. I also want to apologize for my previous post. I missed to add additional quotes.
The code should be:
data:”{‘timeID’: ‘013’}” instead of data:{timeID: “013″}
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comI tried:
data:{timeID: "013"}
data:{"timeID": "013"}
data:"{'timeID': '013'}"
but still get the same error.
Thanks.
Hi thaptu,
I’m afraid that I’m not sure what may be the cause for the behavior you have described. Therefore, providing a small sample in which this can be observed locally will be appreciated. You can send the sample to support@jqwidgets.com.
Best Wishes,
Peter StoevjQWidgets Team
http://www.jqwidgets.comI sent you my project.
Please check my problem asap.
Thanks.
We didn’t receive anything. If you are sending archives, please change the extension to .unzip, .unrar. Otherwise, we may not receive your mail due to security reasons. I would also like to point you to this post: calling-net-webservice-with-jquery.
Best Wishes,
Peter StoevjQWidgets Team
http://www.jqwidgets.comI reply to you.
i changed attach file from zip to unzip.
I need to understand this problem, if ok we will buy the license.
Thank you so much.
Thanks for your help!
I’ve solved problem.
-
AuthorPosts
You must be logged in to reply to this topic.