从ASP.Net访问输出参数的值 [英] access the value of an output parameter from your ASP.Net

查看:86
本文介绍了从ASP.Net访问输出参数的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有一个输出参数为``@returnvalue''的过程.现在,我的问题是如何使用C#在ASP.Net应用程序中访问"@returnvalue"的值.
@returnvalue数据类型是 binary.如何在C#中捕获二进制值
我还粘贴了我正在使用的C#代码.




Hi,

I have procedure with an output parameter ''@returnvalue''. Now My issue is how to access the value of ''@returnvalue'' in my ASP.Net application using C#.
the @returnvalue datatype is binary. how to catch binary value in C#
I have also pasted my C# code which I am using .




public void ConvertCharToBinary(string Value_c)
    {

        string connectionString = "server=SERVER1\\MSSQLSERVER2008; database=sample1; user id=sa; Password=sa";
        SqlConnection _con = new SqlConnection(connectionString);
        SqlCommand _cmd = new SqlCommand("ConvertCharToBinary", _con);
        _cmd.CommandType = CommandType.StoredProcedure;
        
        _cmd.Parameters.Add(new SqlParameter("@Value", Value_c)).Direction = ParameterDirection.Input;
       
       _cmd.Parameters.Add(new SqlParameter("@returnValue", SqlDbType.Binary,8000)).Direction = ParameterDirection.Output;
      
       
        _con.Open();
        _cmd.ExecuteNonQuery();
       
        _con.Close();
       
  Response.Write( _cmd.Parameters["@returnValue"].Value);
    }

推荐答案

问题似乎不是从SQL命令获取返回值,而是将结果写入浏览器流中. />
也许这会有所帮助
http://support.microsoft.com/kb/306654 [
The problem doesn''t appear to be getting return value from the SQL command but rather writing the results into the browser stream.

Maybe this will help
http://support.microsoft.com/kb/306654[^]


通过波纹管链接,它将为您提供帮助

单击此处 [
Go through bellow link, it will help you

click here[^]

Mark as solution if its solved your problem


这篇关于从ASP.Net访问输出参数的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆