Characters added to my parameter in stored procedure
Posted: Wed 28 Jan 2009 22:40
I'm using the Express edition, version number 5.0.20.0.
I created a stored procedure like this:
CREATE DEFINER=`root`@`%` PROCEDURE `udpGetAddressRelatedData`(TheStreet varchar(999))
BEGIN
-- Create an alias for the column names returned because they are used for header text in the application
select n.NeighborhoodName as Neighborhood, c.DistrictID as 'District ID', c.Commissioner from Commissioners as c, Neighborhoods as n, AddrData_by_LSO_2 as a where Street = TheStreet and c.DistrictID = a.DistrictID and n.NeighborhoodID = a.NeighborhoodID;
END
I created a parameter like this:
... new MySqlParameter("@Street", MySqlType.VarChar, 81);
and assigned the value "1423 CATHERINE ST".
I added the parameter to the DataAdapter.SelectCommand.Parameters collection. I then called
...
NumRecords = this.DataAdapter.Fill(this.LocalDataTable);
...
This creates an exception with the text:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ':'1423 CATHERINE ST')' at line 1
I can't tell exactly what is being highlighted and I don't know where the colon and closing parenthesis are coming from. I have tried running the stored procedure from the basic query browser from MySQL and I don't get an error, it just returns nothing. Does anyone know what is happening here?
Thanks.
I created a stored procedure like this:
CREATE DEFINER=`root`@`%` PROCEDURE `udpGetAddressRelatedData`(TheStreet varchar(999))
BEGIN
-- Create an alias for the column names returned because they are used for header text in the application
select n.NeighborhoodName as Neighborhood, c.DistrictID as 'District ID', c.Commissioner from Commissioners as c, Neighborhoods as n, AddrData_by_LSO_2 as a where Street = TheStreet and c.DistrictID = a.DistrictID and n.NeighborhoodID = a.NeighborhoodID;
END
I created a parameter like this:
... new MySqlParameter("@Street", MySqlType.VarChar, 81);
and assigned the value "1423 CATHERINE ST".
I added the parameter to the DataAdapter.SelectCommand.Parameters collection. I then called
...
NumRecords = this.DataAdapter.Fill(this.LocalDataTable);
...
This creates an exception with the text:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ':'1423 CATHERINE ST')' at line 1
I can't tell exactly what is being highlighted and I don't know where the colon and closing parenthesis are coming from. I have tried running the stored procedure from the basic query browser from MySQL and I don't get an error, it just returns nothing. Does anyone know what is happening here?
Thanks.