如题,我写了一段SQL语句declare @tag int;
if exists (select ID from SYSOBJECTS where ID=OBJECT_ID('Voltage'))
set @tag=1;
ELSE set @tag=0;我在C#里面怎么才能引用到上面定义的@tag变量呢?
if exists (select ID from SYSOBJECTS where ID=OBJECT_ID('Voltage'))
set @tag=1;
ELSE set @tag=0;我在C#里面怎么才能引用到上面定义的@tag变量呢?
解决方案 »
- C# Textbox数据绑定问题
- dotmsn2.0加好友问题!知道的帮助下,谢
- 关于应聘.Net程序员的问题!请大家支招!100分相送
- 请问怎么把一个double型数的精度减小?
- .net 2.0Bate和 1.1的政则表达式有区别麽?
- 做安装盘总是:其中用了水晶报表Crystal_Enterprise10,出错信息如下:
- 关于C# winform MDI的问题
- [50分相送!]谁能提供C#中进程间进行通信的资料或者例子?
- 奇怪了!!更新表总是不成功的。
- 有关于IFRMAE问题
- 用vs2008自带的水晶报表,显示多条折线图表
- internal delegate void MethodInvoker<T>(T parameter1); 帮忙看下吧 谢了
{
string connectionString = "*****************************************";
object returns;
using (SqlConnection conn = new SqlConnection(connectionString))
{
SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;
cmd.CommandType = CommandType.StoredProcedure;
SqlParameter p1 = new SqlParameter("@albumID",SqlDbType.Int);
p1.Direction = ParameterDirection.Input;
p1.Value=123;//这里设置输入参数
SqlParameter p2 = new SqlParameter("@returns",SqlDbType.Int);
p2.Direction=ParameterDirection.Output;
p2.Value = DBNull.Value;
cmd.Parameters.Add(p1);
cmd.Parameters.Add(p2);
cmd.CommandText="PRO_ExistsAlbumCover";
try
{
conn.Open();
cmd.ExecuteNonQuery();
returns = cmd.Parameters["@returns"].Value;
}
catch(SqlException ex)
{
throw new Exception(ex.Message);
}
finally
{
cmd.Dispose();
conn.Close();
}
}
Console.WriteLine(returns);
Console.ReadKey();
if exists (select ID from SYSOBJECTS where ID=OBJECT_ID('Voltage'))
set @tag=1;
ELSE set @tag=0;
select @tag
c# 执行