Call Simple Store Procedure : Store Procedure : Database C# Source Code


Custom Search

C# Source Code » Database » Store Procedure »

 

Call Simple Store Procedure








    


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());
   }
}

           
       
    
   
  
   







HTML code for linking to this page:

Follow Navioo On Twitter

C# Source Code

 Navioo Database
» Store Procedure