473,395 Members | 1,440 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

VS2008 report using values from a parametized Stored procedure

2
I want to generate a report showing payslips for a single employee using values from a SP with parameter values that have been passed from a datagrid row. However the report that is generated is blank. What am I missing. Below is what I have.

First I populate the datagrid view using values returned by a function called "sqlselect"

Expand|Select|Wrap|Line Numbers
  1.     Dim dbcall As New dbcalls
  2.         dtgPayslip_Old.DataSource = dbcall.sqlselect("empno AS Employee_Number,empname AS Employee_Name, date AS Date", "payrollarchiveview")
  3.  
Secondly i select empno from datagrid view as the parameter value which I pass to the SP

Expand|Select|Wrap|Line Numbers
  1.  
  2.     Private Sub dtgPayslip_Old_CellDoubleClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dtgPayslip_Old.CellDoubleClick
  3.         Dim dbcall As New dbcalls
  4.         Dim empno As String = dtgPayslip_Old.Item(0, dtgPayslip_Old.CurrentRow.Index).Value.ToString()
  5.  
  6.         dbcall.CallparametizedSP("payrollarchivedataview", "@e", empno)
  7.  
  8.  
The sub that makes a db call

Expand|Select|Wrap|Line Numbers
  1.  
  2.     Public Sub CallparametizedSP(ByVal procedureName As String, ByVal parameter As String, ByVal value As String)
  3.  
  4.         conn.Open()
  5.         cmd.Parameters.AddWithValue(parameter, value)
  6.         cmd.Connection = conn
  7.         cmd.CommandType = CommandType.StoredProcedure
  8.         cmd.CommandText = procedureName
  9.         cmd.CommandTimeout = 6000
  10.         cmd.ExecuteReader()
  11.         cmd.Dispose()
  12.         conn.Close()
  13.  
  14.  
After all this I would expect details of the employee into the report But all I get are the column headings. How can I resolve this. Thank you community
Jan 7 '15 #1
2 8657
Frinavale
9,735 Expert Mod 8TB
Calling the ExecuteReader method alone does not actually retrieve the data. You have to read the data from the reader in order to load the data.

Please see the MSDN documentation for SqlCommand.ExecuteReader Method for more information about this method and how to use it (if you aren't connecting to a MS SQL Server database you will need to check out the documentation for the OleDbCommand.ExecuteReader Method )

-Frinny
Jan 8 '15 #2
szoora
2
The other method was not to run the db call the sp at all. I passed the parameter value directly to the form that has the report viewer control, And I had my reports as expected. Thanks
Jan 8 '15 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Golawala, Moiz M (GE Infrastructure) | last post by:
Hi All, I am having problem returning values from a Stored Procedure that creates a dynamic table (table variable) inserts values during a procedure and then I select from that dynamic table to...
1
by: Chris | last post by:
Hi, I have an application written in ASP and I am converting to ASP.NET in the old ASP page users can add items to a listbox control. When the user hits the "submit" command button on the...
0
by: sbest | last post by:
Hi all, I am trying to execute a MS-SQL 2000 stored proedure from PHP 4.2.2 and return the single row of 3 output values. I've whittled down the error messages so that I'm now mainly getting an...
8
by: Mark Flippin | last post by:
This is for a reporting problem using: Access 2000 SQL Server 2000 Both at SP3 I've a stored procedure in SQL Server 2000 which builds a result set from a disparate set of tables, utilizing...
0
by: Joe | last post by:
Dear Friends, I want dynamically create the Graph from C# application. The graph would be timeInterval VS percentage. timeInterval percentage Recordno 8/2/2003...
2
by: Craig in Boulder | last post by:
I have been trying for over a week to get data from my stored procedure into a Crystal Report in VS.NET 2003 with no luck. I have all sorts of code parts but nothing that tell me how then go...
4
by: Amy | last post by:
Hello, I've been struggling to learn C#.NET for a while now. I've made some progress, but I'm easily stumped. :( What's stumping me today is this: I've got a stored procedure (SQL) that...
7
by: Peter D.C. | last post by:
Hi I want to update data hold in several textbox controls on an asp.net form. But it seems like it is the old textbox values that is "re-updates" through a stored procedure who updates a SQL...
1
by: vncntj | last post by:
I have a C#.NET that simply passes 6 values to a Stored Procedure. But I'm trying to get the (Default.aspx.cs page) to handle passing the values to the sp. The goal is to pass the values and see...
1
by: NareshN | last post by:
Hi, I am using this stored procedure with pivot.If i dont have data i am getting null with this stored procedure.Can u tell me how to handle null.below query is pivot. I am using like...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.