I am Getting the error while executing the code, CommandText Property has been not initialized
public DataTable Mappingdataload(string name)
{
try
{
string spname = "";
switch (name.ToLower())
{
case "student":
spname = "RetrieveStudent";
break;
case "organization":
spname = "RetrieveOrganization";
break;
}
SqlCommand cmd = new SqlCommand();
cmd.Connection = SQLConClass.GetSQLConnection();
cmd.CommandText = spname;
cmd.CommandType = System.Data.CommandType.StoredProcedure;
SqlDataAdapter sqlDataAdapter = new SqlDataAdapter(cmd);
DataTable dataTable = new DataTable();
sqlDataAdapter.Fill(dataTable);
return dataTable;
}
catch (Exception)
{
throw;
}
}