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.CommandType = CommandType.StoredProcedure;
objNumUsers = cmmUser.ExecuteScalar();
Console.WriteLine(objNumUsers.ToString());
}
}
|