Hey all I am getting the error of:
Value of type 'String' cannot be converted to '1-dimensional array of String'.
On this line of my code:
Dim blah As String = webService.theQ(qString:="SELECT blah FROM table WHERE blah = 'hello'")
My web service sqlQ function code is:
<WebMethod(CacheDuration:=60)> _
<ScriptMethod(UseHttpGet:=False, ResponseFormat:=ResponseFormat.Json, XmlSerializeString:=False)> _
Public Function theQ(ByVal qString As List(Of String)) As String
Dim results As Object = fetchSQLQ("query", qString(0))
...etc etc
Dim ser As New System.Web.Script.Serialization.JavaScriptSerializer()
Dim strResponse As String = ser.Serialize(results)
return strResponse
End Function
I'm not sure how to format it like its calling for?
This is how I go about calling it using AJAX (and it works fine):
var sqlCC = "SELECT blah FROM table WHERE blah = 'hello'";
$.ajax({
type : "POST",
crossDomain : true,
dataType : 'json',
cache : false,
contentType : "application/json",
url : "/Service1.asmx/theQ",
data : JSON.stringify({
qString : [sqlCC]
}),
success : function (data2) {
var obj2 = jQuery.parseJSON(data2);
},
error : function (xhr, status, error) {
console.log(xhr.responseText);
}
});
Any help would be great!
Subwhich produce no return value but you use it as aFunction