TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Peter Dzuya
NA
313
40.8k
display data to reports via a stored proceedure
Apr 1 2015 10:51 AM
Hi All. Still new to C#.
I have a code as shown below that I used to obtain data from a stored procedure query that throws an error "Procedure or function 'RptLedgerByDate' has too may arguments specified".
public bool LoadReport()
{
SqlConnection conReport = new SqlConnection(ConfigurationManager.ConnectionStrings["makConnection"].ToString());
SqlCommand cmdReport = new SqlCommand();
cmdReport.Connection = conReport;
cmdReport.CommandType = CommandType.StoredProcedure;
cmdReport.CommandText = "RPTLedgerByDate";
cmdReport.Parameters.AddWithValue("@glCode", GlCode);
cmdReport.Parameters.AddWithValue ( "@fromDate", FromDate );
cmdReport.Parameters.AddWithValue ( "@toDate", ToDate );
SqlDataReader drReport;
DataSet dsReport = new dsReports();
conReport.Open();
drReport = cmdReport.ExecuteReader();
dsReport.Tables[0].Load(drReport);
drReport.Close();
conReport.Close();
if (!(dsReport.Tables[0].Rows.Count > 0))
{
MessageBox.Show("No Available Report Data to Display.",
"SMIS 2015", MessageBoxButtons.OK, MessageBoxIcon.Information);
isReady = false;
this.Close();
}
I shall be glad if I get assisted. Thanks
Reply
Answers (
6
)
How to pass data from childform to parentform ?
Export table from Service-based Database to Microsoft access