stored procedures in mysql
-
hi, am not getting what's wrong in this procedure: create procedure getpassword( in member varchar(20)) begin select password from admin where member_id = member end am getting error at "end" syntax error unexpected end,expecting ;
-
hi, am not getting what's wrong in this procedure: create procedure getpassword( in member varchar(20)) begin select password from admin where member_id = member end am getting error at "end" syntax error unexpected end,expecting ;
Try this:
create procedure getpassword(@member varchar(20))
as
beginselect password from admin where member_id = @member
end
“That which can be asserted without evidence, can be dismissed without evidence.”
― Christopher Hitchens
-
Try this:
create procedure getpassword(@member varchar(20))
as
beginselect password from admin where member_id = @member
end
“That which can be asserted without evidence, can be dismissed without evidence.”
― Christopher Hitchens
am executing it in workbench, am i right. still am getting error at @
-
hi, am not getting what's wrong in this procedure: create procedure getpassword( in member varchar(20)) begin select password from admin where member_id = member end am getting error at "end" syntax error unexpected end,expecting ;
You need to put a semi-colon at the end of your statement before the END keyword :
CREATE PROCEDURE getpassword( IN member varchar(20))
BEGIN
SELECT password FROM admin WHERE member_id = member**;**
ENDWhen I was a coder, we worked on algorithms. Today, we memorize APIs for countless libraries — those libraries have the algorithms - Eric Allman
-
am executing it in workbench, am i right. still am getting error at @
How are you calling the procedure? It should work if you call the stored procedure in one of the two following ways:
getpassword @member = 'fred smith'
getpassword 'fred smith'
“That which can be asserted without evidence, can be dismissed without evidence.”
― Christopher Hitchens
-
You need to put a semi-colon at the end of your statement before the END keyword :
CREATE PROCEDURE getpassword( IN member varchar(20))
BEGIN
SELECT password FROM admin WHERE member_id = member**;**
ENDWhen I was a coder, we worked on algorithms. Today, we memorize APIs for countless libraries — those libraries have the algorithms - Eric Allman
How to test it in workbench, whether it's working or not.
-
You need to put a semi-colon at the end of your statement before the END keyword :
CREATE PROCEDURE getpassword( IN member varchar(20))
BEGIN
SELECT password FROM admin WHERE member_id = member**;**
ENDWhen I was a coder, we worked on algorithms. Today, we memorize APIs for countless libraries — those libraries have the algorithms - Eric Allman
thanq , how can i test in workbench, whether in query, or at stored procedures
-
You need to put a semi-colon at the end of your statement before the END keyword :
CREATE PROCEDURE getpassword( IN member varchar(20))
BEGIN
SELECT password FROM admin WHERE member_id = member**;**
ENDWhen I was a coder, we worked on algorithms. Today, we memorize APIs for countless libraries — those libraries have the algorithms - Eric Allman
how can i test whether it's working or not in workbench. am testing in query as: execute getpassword 'stl123'; but it's giving errors. and in my c# code is:
MySqlCommand command = new MySqlCommand("getpassword", con);
command.CommandType = System.Data.CommandType.StoredProcedure;
command.Parameters.AddWithValue("@member", txtuser.Text);
con.Open();
using (MySqlDataReader rdr = command.ExecuteReader())
{
if (rdr.Read())
{reader object rdr is showing no rows.
-
how can i test whether it's working or not in workbench. am testing in query as: execute getpassword 'stl123'; but it's giving errors. and in my c# code is:
MySqlCommand command = new MySqlCommand("getpassword", con);
command.CommandType = System.Data.CommandType.StoredProcedure;
command.Parameters.AddWithValue("@member", txtuser.Text);
con.Open();
using (MySqlDataReader rdr = command.ExecuteReader())
{
if (rdr.Read())
{reader object rdr is showing no rows.
Change this:
Member 10263519 wrote:
command.Parameters.AddWithValue("@member", txtuser.Text);
To this(remove the @ as it is not required from .net):
Member 10263519 wrote:
command.Parameters.AddWithValue("member", txtuser.Text);
“That which can be asserted without evidence, can be dismissed without evidence.”
― Christopher Hitchens