-2
create proc sp_dropdown
as
begin
SELECT r1.regid, r.registration
FROM table1 as r1
INNER JOIN table2 as r ON r1.regid=r.registration and r1.status=r.status
end
create proc sp_dropdown
as
begin
SELECT r1.regid, r.registration
FROM table1 as r1
INNER JOIN table2 as r ON r1.regid=r.registration and r1.status=r.status
end
この上記のクラスは、
public class GetAllTableNames_Result
{
public string Name { get; set; }
}
私のSPの戻り値の型であると私はあなたを信じて、このような
public List<GetAllTableNames_Result> GetTableNames()
{
List<GetAllTableNames_Result> gatnr = new List<GetAllTableNames_Result>();
SqlCommand cmd = new SqlCommand(
"GetAllTableNames", _connection) {CommandType = CommandType.StoredProcedure};
try
{
_connection.Open();
SqlDataReader rdr = cmd.ExecuteReader();
while (rdr.Read())
{
//do something with data
gatnr.Add(new GetAllTableNames_Result()
{
Name = rdr[0].ToString()
});
}
_connection.Close();
return gatnr;
}
catch (Exception e)
{
Console.WriteLine(e);
throw;
}
finally
{
_connection.Close();
}
}
を呼び出すことができますポイントを得ることができます
パラメータを持っているが、パラメータを持たないものとまったく同じです。 [ask]を読んで研究を分かち合う。 – CodeCaster