i have to show data in datagrid using store procedure...but remember...i m using store procure in seprate class so i m facing difficulties..
how to do it..
thats my class coding...
but how to pass it in main form?

public Searching()
            Myconnection = new SqlConnection("Data Source=.;Initial Catalog=Bahria_Managment;Integrated Security=True");
        public void Search_Student(int S_RegNo)
            Mycommand = new SqlCommand("Search_Student",Myconnection);
            MyDataAdapter = new SqlDataAdapter(Mycommand);
            myDataSet = new DataSet();


conn1 is sqlconnection object, command1 is sqlcommand object, storedProceName is the stired procedure you want to pass to the command, createConnection() is the function to create connection if it is not working, This code works to execute store procedures. Write this code any where in ur application and call it when you want to call any stored procedure passing it the table name, dataset in use and the stored procedure name which you want to execute.

public static int runProcedure(DataSet myDataSet, string storedProceName, string tblName)
                if (Conn1.State == 0)
                Command1.Connection = Conn1;
                Command1.CommandText = storedProceName;
                Command1.CommandType = CommandType.StoredProcedure;
                MyDataAdapter.SelectCommand = (Command1);
                MyDataAdapter.Fill(myDataSet, tblName);


Use OBJECT DATA SOURCE while binding the dataset with the Grid view. It will automatically bind the dataset of the method and will return the values in a grid view.
I hope your class method is returning a DATASET.
Hope it helps!!!!