This is a discussion on Problem with create procedure within the MySQL forums, part of the Database Server Software category; --> Ted wrote: > On Feb 16, 9:21 am, Jerry Stuckle <jstuck...@attglobal.net> wrote: >> Ted wrote: >> >> <snipped good ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Ted wrote: > On Feb 16, 9:21 am, Jerry Stuckle <jstuck...@attglobal.net> wrote: >> Ted wrote: >> >> <snipped good stuff to save electrons> >> >> >> >> >> >> >> >>> When I do something similar, with data from an MS SQL Server 2005 >>> database, changing the value in one control results in the items in >>> the other control (a drop down list) are changed. The principle >>> difference is that the code for data from MS SQL Server involved >>> testing for equality of integers while this code looks for records in >>> which one column contains a string that itself contains the string >>> provided in the parameter. >>> In the sample ASP.NET 2 code above, the controls are properly created, >>> but the dropdown lists never get any of the data that ought to have >>> been returned by the SQL statement. >>> Thanks, >>> Ted >> Hi, Ted, >> >> I don't do ASP.NET, but I (think I was) able to understand your code. >> >> A couple of things: >> >> In your stored proc, 'ss' should be in single quotes since it's text >> (sorry - missed that before). >> >> Also, in your SELECT statement for SqlDataSource2, what would be in @ss? >> You're doing a LIKE statement looking for text within a column of >> text, so it should be something like >> >> '%i want this%' >> >> Also, since it's a string, SQL indicated it should be within single >> quotes, as indicated above. >> >> Also, I don't see where you are checking for any errors from MySQL. I >> don't know how to do it in ASP.NET - but you should always be checking >> the results for any errors. In PHP, for instance, the result for a >> query is false when it fails, and mysql_error() retrieves the error text. >> >> Other than that I don't see anything wrong with your code. And since >> you've gotten similar to work with integers, it may just be the missing >> single quotes. >> >> One of these days I'm going to have to learn ASP.NET. But I'm still >> stuck maintaining some VBScript sites :-) >> >> -- >> ================== >> Remove the "x" from my email address >> Jerry Stuckle >> JDS Computer Training Corp. >> jstuck...@attglobal.net >> ==================- Hide quoted text - >> >> - Show quoted text - > > OK, I tried enclosing @ss in single quotes, and it had no effect. > > I am a bit puzzled now. On rereading the MySQL manual, I see 'CALL' > returns the number of records. But the manual also says "MySQL > supports the very useful extension that allows the use of regular > SELECT statements (that is, without using cursors or local variables) > inside a stored procedure. The result set of such a query is simply > sent directly to the client." HOW? How can a CALL statement return > both the number of records and a result set? And if this is an > "extension", do any other RDBMS support it, and more importantly, do > libraries or frameworks such as JDBC or ADO.NET2 know anything about > it? > > Thanks > > Ted > Ted, OK, I was just trying to see if there were any errors first. To return values from a SP, you also need to use one or more OUT parameters. See <http://dev.mysql.com/doc/refman/5.1/en/create-procedure.html> And this is pretty standard SQL. I'm not sure exactly how it's implemented in other databases; the only one I've used very much has been DB2 and that supports a similar syntax (not quite the same, but close). Did you check for any errors from the MySQL calls? That's the most important thing. Any error messages will really help determine the problem(s). -- ================== Remove the "x" from my email address Jerry Stuckle JDS Computer Training Corp. jstucklex@attglobal.net ================== |