에 의해 반환 된 값을 읽는 방법 C#을 사용하여 TextBox에서 다음 절차에 따라 반환되는 값을 읽어야합니다.내 프로젝트 중 하나에서 SP
누구나 PLZ를 사용하여 @a를 읽는 코드를 C#을 사용하여 다음 절차에 따라 반환 된 TextBox에 쓸 수 있습니까? ??
create procedure [dbo].[Test]
as
declare
@a numeric(5)
begin
set @a = (select COUNT(*) from Emp);
return @a
end
내가 봤어이
는SqlConnection cn = new SqlConnection("data source=localhost;initial catalog=acc;uid=sa;pwd=fantastic");
cn.Open();
SqlCommand cmd = cn.CreateCommand();
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "Test";
Int32 i = Convert.ToInt32(cmd.ExecuteScalar());
textBox1.Text = i.ToString();
는
내가 뭘 하려는지 내 질문에 plzz 편집 – kashif
그리고 무슨 일을하지 못했습니까? 오류가 있었습니까? 예외? 네가 기대하지 않았던 (또는 네가 그런 일이 없었던) 일은 무엇인가? – Oded
나는 실제 번호를 얻지 못하고있다. Count (*)가 23 일 때 0이되었습니다 – kashif