Click here to Skip to main content
15,895,709 members
Home / Discussions / Database
   

Database

 
GeneralRe: Return 0 when no rows [modified] Pin
Heinz_17-Jul-06 9:30
Heinz_17-Jul-06 9:30 
GeneralRe: Return 0 when no rows Pin
Ennis Ray Lynch, Jr.17-Jul-06 12:42
Ennis Ray Lynch, Jr.17-Jul-06 12:42 
GeneralRe: Return 0 when no rows [modified] Pin
ra ra ra ra17-Jul-06 22:22
ra ra ra ra17-Jul-06 22:22 
GeneralRe: Return 0 when no rows [modified] Pin
Heinz_18-Jul-06 8:27
Heinz_18-Jul-06 8:27 
Questioncan we create stored procedures in MS Access database Pin
ChennaiBabu14-Jul-06 21:15
ChennaiBabu14-Jul-06 21:15 
AnswerRe: can we create stored procedures in MS Access database Pin
mysorian15-Jul-06 4:43
professionalmysorian15-Jul-06 4:43 
AnswerRe: can we create stored procedures in MS Access database Pin
ra ra ra ra17-Jul-06 22:28
ra ra ra ra17-Jul-06 22:28 
Questionstored procedure Output parameter value is Null Pin
For_IT14-Jul-06 12:26
For_IT14-Jul-06 12:26 
Hi
I am using following stored procedure
-----------------------------------
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
GO

ALTER PROCEDURE [dbo].[GetUserControlTemplateCode]
@product_id int,
@genmask_code nvarchar(max) output
AS
BEGIN
SET NOCOUNT ON;

Select dbo.cp_product.product_type, dbo.cp_genmask.genmask_code
from dbo.cp_genmask inner join dbo.cp_product
on dbo.cp_genmask.genmask_product_type=dbo.cp_product.product_type
where dbo.cp_product.product_id=@product_id

END
--------------------------------
when I execute the above code using

exec GetUserControlTemplateCode 1,'x'

I get correct values for x i.e. output parameter.


My code behind to call stored procedure is as follows

---------------------------------
protected void Page_Load(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["sConnectionString2"].ConnectionString);
SqlCommand Com = con.CreateCommand();
Com.CommandType = CommandType.StoredProcedure;
Com.CommandText = "GetUserControlTemplateCode";

//Create parameter object to provide input
SqlParameter parInput = Com.Parameters.Add("@product_id", SqlDbType.Int);
parInput.Direction = ParameterDirection.Input;
parInput.Value = nProductID;

// Create parameter to hold output
SqlParameter parOutput = Com.Parameters.Add("@genmask_code", SqlDbType.NVarChar,300);
parOutput.Direction = ParameterDirection.Output;

//Open the connection
con.Open();
//Execute command
try
{
Com.ExecuteNonQuery();
}
catch (Exception ex)
{
Response.Write(ex.ToString());
}

string sTemplateCode = Convert.ToString(parOutput.Value);
sTemplateCode = sTemplateCode.Replace("ProductID", nProductID.ToString());
Control myControl = ParseControl(sTemplateCode);
PlaceHolderForProducts.Controls.Add(myControl);
con.Close();
}
-----------------------------------

when I execute the code, i do not get any exception, but the value of output parameter is null.

Can someone please help me to understand whats missing here?

Thanks.

AnswerRe: stored procedure Output parameter value is Null Pin
nguyenvhn14-Jul-06 16:24
nguyenvhn14-Jul-06 16:24 
AnswerRe: stored procedure Output parameter value is Null Pin
Colin Angus Mackay14-Jul-06 21:53
Colin Angus Mackay14-Jul-06 21:53 
GeneralRe: stored procedure Output parameter value is Null Pin
Mike Dimmick15-Jul-06 3:57
Mike Dimmick15-Jul-06 3:57 
GeneralRe: stored procedure Output parameter value is Null Pin
For_IT16-Jul-06 11:05
For_IT16-Jul-06 11:05 
GeneralRe: stored procedure Output parameter value is Null Pin
For_IT16-Jul-06 12:18
For_IT16-Jul-06 12:18 
QuestionProblem accessing a SSIS Package Pin
mysorian14-Jul-06 6:04
professionalmysorian14-Jul-06 6:04 
AnswerRe: Problem accessing a SSIS Package Pin
mysorian14-Jul-06 7:54
professionalmysorian14-Jul-06 7:54 
AnswerRe: Problem accessing a SSIS Package Pin
Dave Kreskowiak14-Jul-06 9:30
mveDave Kreskowiak14-Jul-06 9:30 
GeneralRe: Problem accessing a SSIS Package Pin
mysorian15-Jul-06 4:39
professionalmysorian15-Jul-06 4:39 
QuestionDifferance between '@variable' and '@@variable' in SQL Pin
Sampath Eleperuma14-Jul-06 4:09
professionalSampath Eleperuma14-Jul-06 4:09 
AnswerRe: Differance between '@variable' and '@@variable' in SQL Pin
Eric Dahlvang14-Jul-06 5:12
Eric Dahlvang14-Jul-06 5:12 
Questionnumeric data type value Pin
For_IT14-Jul-06 0:06
For_IT14-Jul-06 0:06 
AnswerRe: numeric data type value Pin
Mike Dimmick14-Jul-06 0:27
Mike Dimmick14-Jul-06 0:27 
GeneralRe: numeric data type value Pin
For_IT14-Jul-06 0:55
For_IT14-Jul-06 0:55 
GeneralRe: numeric data type value Pin
Mairaaj Khan14-Jul-06 2:02
professionalMairaaj Khan14-Jul-06 2:02 
GeneralRe: numeric data type value Pin
For_IT14-Jul-06 3:11
For_IT14-Jul-06 3:11 
AnswerRe: numeric data type value Pin
Heinz_15-Jul-06 14:27
Heinz_15-Jul-06 14:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.