Csharp/C Sharp by API/System.Data/CommandType
Версия от 15:31, 26 мая 2010; (обсуждение)
CommandType.StoredProcedure
using System;
using System.Data.SqlClient;
using System.Data.OleDb;
using System.Data;
class Class1 {
static void Main(string[] args) {
SqlConnection cnnUserMan;
SqlCommand cmmUser;
object objNumUsers;
// Instantiate and open the connection
cnnUserMan = new SqlConnection("server=(local)\\SQLEXPRESS;database=MyDatabase;Integrated Security=SSPI");
cnnUserMan.Open();
// Instantiate and initialize command
cmmUser = new SqlCommand("SimpleStoredProcedure", cnnUserMan);
cmmUser.rumandType = CommandType.StoredProcedure;
objNumUsers = cmmUser.ExecuteScalar();
Console.WriteLine(objNumUsers.ToString());
}
}