Click here to Skip to main content
11,485,982 members (72,549 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP MySQL
This is mysql routine(store procedure)...
-- --------------------------------------------------------------------------------
-- Routine DDL
-- Note: comments before and after the routine body will not be stored by the server
-- --------------------------------------------------------------------------------
DELIMITER $$
 
CREATE DEFINER=`root`@`localhost` PROCEDURE `InUser`(
IN Id INTEGER,
In UId Integer,
In UIdTo Integer,
out R_Id Integer
)
BEGIN
	IF Id = 0 THEN     
		insert into test.main
		select (SELECT COALESCE(max(test.main.Id),0)+1 FROM test.main) as id,UId as uid;
 
		insert into test.main
		select (SELECT max(test.main.Id) FROM test.main) as id,UIdTo as uid;  
		
		set R_Id = (select max(id) from test.main);
	Else
		insert into test.main
		select test.main.Id as id,UIdTo as uid; 
 
		set R_Id = (select max(test.main.id) from test.main);
	End If;
END


ASP CODE is as below...
<html>
<body>
 
<form >
 <%
 MsgBox "Hello, World!"
 on error resume next
        Set OBJdbConnection1 = Server.CreateObject("ADODB.Connection")
        OBJdbConnection1.ConnectionTimeout = Session("ConnectionTimeout")
        OBJdbConnection1.CommandTimeout = Session("CommandTimeout")
        OBJdbConnection1.Open  Session("ConnectionString")
 
     dim Uid,Id
     Uid = 1'request.form("Uid")
     Id = 0'request.form("Id")

     Set SQLStmt1 = Server.CreateObject("ADODB.Command")
     Dim sqlstr, result
     sqlstr = "InUser";
 

     SQLStmt1.CommandText = sqlstr
     SQLStmt1.CommandType = adCmdStoredProc
     Set SQLStmt1.ActiveConnection = OBJdbConnection1
 
    SQLStmt1.Parameters.Append(SQLStmt1.createParameter("Id",adInteger,adParamInput,50,Id))
    SQLStmt1.Parameters.Append(SQLStmt1.createParameter("UId", adInteger,adParamInput,50,Session("UId")))
    SQLStmt1.Parameters.Append(SQLStmt1.createParameter("ToUId",adInteger,adParamInput,50,Uid))
    SQLStmt1.Parameters.Append(SQLStmt1.createParameter("R_id",adInteger,adParamOutput,50,Id))
 

     result = OBJdbConnection.Execute(sqlstr)
     id=SQLStmt1.Parameters("R_id").value
     response.write(id)
    
%>
 
</form >
</body>
</html>


not showing error or messagebox
and not calling sp

please help
Posted 20-Jan-13 20:43pm
Edited 20-Jan-13 20:45pm
v2
Comments
Om Prakash Pant at 21-Jan-13 3:58am
   
remove "on error resume next" to see the actual error.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 8,819
1 OriginalGriff 8,047
2 Sascha Lefèvre 3,199
3 Maciej Los 2,886
4 Richard Deeming 2,370


Advertise | Privacy | Mobile
Web01 | 2.8.150520.1 | Last Updated 21 Jan 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100