Hi,
Not sure why this hasn't appeared... anyhoo....
I've hit a bit of a problem with a jQuery and a webservice. The webservice is in VB.NET and it's been quite a while since I last did anything in VB or a webservice.
Thing is, I'm not sure if the problem is in the query or in the code. All I get when I run is a button (which is correct) and after I click it, I get an error 500 - which doesn't really help.
The query (below) has security issues which I'm completely aware of - but as it's for my own use, that's ok - I can tidy that up at some point if I decide to use it. -
<html xmlns="http://www.w3.org/1999/xhtml">
-
<head runat="server">
-
<title>A quick and dirty hack</title>
-
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js" type="text/javascript"></script>
-
<script type="text/javascript">
-
$(document).ready(function() {
-
$("#btnMore").click(function() {
-
$.ajax({
-
type:"POST",
-
contentType: "application/json; charset=utf-8",
-
url: "WebService1.asmx/GetData",
-
data: "{'localhost', 'root', '', 'Table1', {'SELECT','Name','where','age > 25','and','hometown == Liverpool'}, {'','','',''}",
-
success: onSuccess,
-
error: onError
-
});
-
});
-
});
-
-
function onSuccess(result)
-
{
-
$("#datalist").empty()
-
var strings = result.d;
-
for (var i = 0; i < strings.length; ++i)
-
$("#datalist").append("<li>" + strings[i] + "</li>");
-
}
-
-
function onError(result)
-
{
-
alert(result.status + ": " + result.statusText);
-
}
-
-
</script>
-
</head>
-
I have a feeling that it's down to what I'm passing into the webservice rather than the webservice -
<System.Web.Script.Services.ScriptService()> _
-
<System.Web.Services.WebService(Namespace:="http://tempuri.org/")> _
-
<System.Web.Services.WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
-
<ToolboxItem(False)> _
-
Public Class WebService1
-
Inherits System.Web.Services.WebService
-
-
<WebMethod()> _
-
Public Function GetData(ByVal server As String, ByVal uid As String, ByVal pw As String, _
-
ByVal db As String, ByVal cmds As ArrayList, ByVal tbl As ArrayList) As DataSet
-
Dim connection As SqlConnection
-
Dim data As New DataSet("GetDataSet")
-
Dim constr As String = "server=" + server + "; uid=" + uid + "; pwd=" + pw + "; database=" + db
-
Try
-
connection = New SqlConnection(constr)
-
connection.Open()
-
For i = 0 To cmds.Count
-
If (Not (cmds(i).ToString()).StartsWith(("SELECT" Or "Select"))) Then
-
Throw MySQLException("The SQL command must start with SELECT or Select")
-
End If
-
Dim command As New SqlCommand
-
command.Connection = connection
-
command.CommandText = cmds(i).ToString()
-
Dim dataadapter As New SqlDataAdapter
-
dataadapter.SelectCommand = command
-
dataadapter.TableMappings.Add("Table", tbl(i).ToString())
-
dataadapter.Fill(data)
-
Return data
-
Next
-
-
Catch ex As System.Data.SqlClient.SqlException
-
Throw
-
End Try
-
connection.Close()
-
End Function
-
-
Private Function MySQLException(ByVal p1 As String) As Exception
-
Throw New NotImplementedException
-
End Function
-
-
End Class
-
Am I correct in thinking that I'm just passing things in correctly or is there something else I've missed?
Thanks
Paul
6 2180
A 500 error messages means that there was a general error that occurred on the server while processing. If you have access to the Windows Event logs on the server where your application is hosted I would check them for anything that might explain what is causing the 500 error.
-Frinny
It's being done through VS2010 via localhost. Not sure where to look for it under Win7 (normally I use Linux)
Go to - Control Panel
- Administrative Tools
- Event Viewer
This will let you view the Windows Event logs. Expand the "Windows Logs" tree and go through the Event Logs under that tree to view any events or errors that Windows has encountered. Look for anything related to IIS, or ASP.NET or your application...
-Frinny
Just curious, why aren't you using the built in debugging capabilities of Visual Studio 2010?
I'm new to VS2010. If I set a breakpoint in the VB it comes up with a page that says Webservice1 and shows the method available. If I click on the method is comes up with that "the test form is only available for methods with primitive types as parameters" followed by some soap 1.1 stuff
By the looks of it, passing ArrayLists are a no-no, but looking at http://www.c-sharpcorner.com/UploadF...ebService.aspx, arraylists are fine to pass.
HELP - which one is right or is it a language specific problem? (the above is in C#, mine is in VB)
Not really used to VS2010, but it's getting me further.
If I put a breakpoint in the VB I get a screen saying WebService1 which means (to me) that it's sending to VB ok. If I click on the GetData method, it comes up with a message that only primitives are allowed to be passed in, so I'm guessing that means ArrayLists are right out.
However, googling around has brought me to http://www.c-sharpcorner.com/UploadF...ebService.aspx which suggests that passing ArrayLists to a webservice is ok.
Have I hit a VB specific problem or am I missing something?
Paul
Sign in to post your reply or Sign up for a free account.
Similar topics
by: James |
last post by:
Please help - getting very desperate! Sun, 12 October 2003 05:39
I have PHPDEV 4.2.3 from Firepages.com.au as the upgrade to 4.3.0 did
not work. I also had an abortive download from PHP.NET as...
|
by: duikboot |
last post by:
Hi all,
I'm trying to export a view tables from a Oracle database to a Mysql
database. I create insert statements (they look alright), but it all goes
wrong when I try to execute them in Mysql,...
|
by: Erik R.N. |
last post by:
Hi
2 years ago i managed to set up my PC to be able to upload semicolonseparated
database-files to my mysql-database on a webhost-server which also contain my
website (from where one can do search...
|
by: Dominik Szczurek |
last post by:
Hello to anyone who is tring to help me :-)
As I was writed in the topic I have problem when somone input 0 value in the
form.
PHP is losting this value when it try to write it to mySQL.
I have...
|
by: trihanhcie |
last post by:
I m currently working on a Unix server with a fedora 3 as an os
My current version of mysql is 3.23.58. I'd like to upgrade the version
to 5.0.18.
After downloading from MYSQL.COM the package on...
|
by: Henry16 |
last post by:
Hi.
Impossible to create a database using MySQL !!!
Message : #1006 - Can't create database 'boby'. (errno: 13)
I was told :
chown mysql.mysql -R /var/lib/mysql
chmod 750 -R /var/lib/mysql...
|
by: edward_sanders |
last post by:
Hi,
This is a newbie question. I am using a text for learning php/mysql.
I am using PHP 5.2.x and mysql 5.
The example is that of a mysql
database of jokes. Before we get to joins there is a...
|
by: suma |
last post by:
hi to all
plaese help me i have same problem when download the phpdev and
phptriad i cant connect to mysql when click the MyAdmin apear this
messege in the page
'Warning: MySQL Connection...
|
by: Bobby Edward |
last post by:
I am using VS 2008 SP1, ASP.NET 3.5, VB.NET, MySQL (latest version).
I created a new dataset using VS. In the ds I have a users table. I let it
create the "Fill, GetData" functions in the...
|
by: DarkGiank |
last post by:
Hi, im new to csharp and im trying to create a class that can change the application database without no rewriting all connection code... but cause some reason it is not working... it tells me that...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |