I am trying to develop a report as pdf, i get thrown for an error saying "Cannot find the store procedure" . But there is a store procedure on the database table name 'Tbl_TrainingAcademy'.
-
-
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Data.SqlClient;
- using System.Configuration;
- using System.Web;
- using ContentManagementSystem.Models;
- using System.Data;
-
- namespace ContentManagementSystem.Repository
- {
- public class ReportsMaster : IlReports
- {
- public DataSet Generate_AdvertDetailsReport()
- {
- using(SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["eNtsaOnlineRegistrationDB"].ToString()))
- {
- con.Open();
- DataSet ds = new DataSet();
-
-
- try
- {
- SqlCommand cmd = new SqlCommand("GetAdvertReport", con);
- cmd.CommandType = CommandType.StoredProcedure;
- SqlDataAdapter da = new SqlDataAdapter();
- da.SelectCommand = cmd;
- da.Fill(ds);
-
- if(ds.Tables.Count > 0)
- {
- return ds;
- }
- else
- {
- return ds = null;
- }
-
- }
- catch(Exception )
- {
- throw;
- }
- finally
- {
- ds.Dispose();
- }
- }
- }
- }
- }
-
- <connectionStrings>
- <add name="eNtsaOnlineRegistrationDB" connectionString="Data Source=(LocalDb)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\eNtsaOnlineRegistrationDB.mdf;Initial Catalog=eNtsaOnlineRegistrationDB; Integrated Security=True" providerName="System.Data.SqlClient" />
- </connectionStrings>