Click here to Skip to main content
15,885,720 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
can anybody please help me ----this is not returning anything

public static void PopulateCacheUserPercentageMarksForClass()
{
try
{
short? returnValue = 0;
string errMsg = "";
var param = new DynamicParameters();
param.Add("@Return", 0, direction: ParameterDirection.Output);
param.Add("@RetunErrMsg", string.Empty, direction: ParameterDirection.Output);
using (var connection = new SqlConnection(ConnectionManager.ConnectionString))
{
if (connection.State != ConnectionState.Open)
{
connection.Open();

}
connection.Execute("s_tidx_PopulateCacheUserPercentageMarksForClass", param, commandType: CommandType.StoredProcedure);
returnValue = param.Get<short?>("@Return");
errMsg = param.Get<string>("@RetunErrMsg");

}
}
catch (Exception ex)
{

}
}
Posted
Comments
[no name] 23-Aug-14 10:44am    
Check your exceptions.
Sergey Alexandrovich Kryukov 23-Aug-14 23:46pm    
What exception? This code should not compile. :-)
Please see my answer... :-)
—SA
Member 9425683 25-Aug-14 1:41am    
it is returning -1

1 solution

There is no such method "SqlConnection.Execute": http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlconnection%28v=vs.110%29.aspx[^].

The whole idea is totally wrong; and the code could not even compile.

Look at SqlQuery instead:
http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlcommand%28v=vs.110%29.aspx[^].

—SA
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900