如何使用C#在消息框中获取SQL数据列 [英] How to get sql data column in message box using c#
本文介绍了如何使用C#在消息框中获取SQL数据列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是我的存储过程,我想在使用SQL C#代码的消息框中显示idcount
This is my stored procedure i want to display idcount in message box in using to sql C# code
ALTER PROCEDURE [dbo].[Transaction]
(
@Patient nvarchar(50),
@E_TO nvarchar(50),
@R_type int,
@User_id uniqueidentifier,
@ReportType nvarchar(50),
@Patient_no int,
@Patient_ID_NO numeric(18,0),
@idcount int output
)
AS
BEGIN
declare @tempid int
set @tempid = 0;
declare @idcnt int
select @idcnt =isnull( max(idcount),0) from Transactions where year(R_date)=year(getdate())
if (@idcnt =0)
set @tempid=1
else
set @tempid = @idcnt +1
INSERT INTO dbo.Transactions (Patient,E_TO,R_date,R_from,User_id,report_type,Patient_no,Patient_ID_NO,idcount)values (@Patient,@E_TO,getdate(),@R_type,@User_id,@ReportType,@Patient_no,@Patient_ID_NO,@tempid)
return @idcount
END
推荐答案
我认为您的存储过程正确.
您需要像这样在C#应用程序中获取输出参数.
Hi,
I think your stored Procedure is right.
You need to fetch output parameter in your C# Application like.
cnnConnection.Open();
cmdSQLCommand.ExecuteNonQuery();
// Read Values of Output Paramters and Stored into Property
string mErrorMsg ="";
mErrorMsg = (string)(cmdSQLCommand.Parameters["@idcount"].Value);
我如何使用LINQ在c#中获取我的idcount ??请访问此链接....我的代码在这里
LINQ to sql一列未插入 [ ^ ]
how can i fetch my idcount in c# using LINQ???? visit this link please.... i have my code here
LINQ to sql one column is not inserting[^]
这篇关于如何使用C#在消息框中获取SQL数据列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文