ReportViewer is not displaying data . - asp.net

I want to use Report Viewer in my project.
i have
1. CustomerDetails - Stored Procedure
2. CustomerDataset.xsd - in which i dragged n dropped the stored procedure.
3. CustomerReport.rdlc - in which i have crated a table which and data set is
CustomerDetails
4. CustomerReportViewer.aspx - in which the CustomerReoprt.rdlc is being binded.
now, i want to pass 2 values "chkeckInDate" and "checkOutDate" from 2 text box which are to be filled by use from "main.aspx" also i 'm calling my stored procedure from this file .
the report viewer is getting displayed but, the contents are not getting displayed (i have executed my stored procedure and it is running perfectly.)
How can i fix it? please help.

I didn't clearly understand where is the mistake, but I think you have the code under page_load event. Copy the code into button_click.
This is what I've used..
You must inport this:
Imports Microsoft.Reporting.WinForms
You should pass the textbox value as parameter.
Dim yr As New ReportParameter("param1", TextBox1.Text)
Try
Me.your_TableAdapter.Fill(Me.DataSet_name.table_name)
ReportViewer1.LocalReport.SetParameters(New ReportParameter() {yr})
Me.ReportViewer1.RefreshReport()
Catch ex As Exception
MsgBox("try again")
End Try
copy these two lines from page_load event into button_click.
Me.your_TableAdapter.Fill(Me.DataSet_name.table_name)
Me.ReportViewer1.RefreshReport()
Further, watch this

Related

Restoring MS Project Views

I'm running a user defined script that changes the view during the course of its computations. When I launch the VBA script, the view is in no particular filter, table or view name. I want to restore the view just as it was before the user launched the script including which task has the focus. It seems like naming the view as the first step when the script launches and saving the task which has focus then activating the view and focus at the completion of the script is a potential way to do this but I'm not having any success. I would delete the named view at the end of running the script. Any suggestions or point me to previous discussions on this forum that may have answered; my search didn't reveal any.
Rod Gill suggested the following but unless I'm doing something wrong it doesn't appear to work.
Dim OrgnlID As Long
Dim OrgnlView As String
Dim OrgnlTable As String
Dim OrgnlFilter As String
OrgnlView = ActiveProject.CurrentView
OrgnlTable = ActiveProject.CurrentTable
OrgnlFilter = ActiveProject.CurrentFilter
OrgnlID = ActiveCell.Issue
' place your code here that does the view manipulations
' followed by the lines below to restore the view before manipulations
ViewApply OrgnlView
TableApply OrgnlTable
FilterApply OrgnlFilter
EditGoTo ID:=OrgnlID

Access 2013 unable to add new line to form and runtime error 2105 when trying to a new record

I am migrating several adp files to accdb so that it can work under access 2013 but one problem is driving me nuts:
I have a form on which I cannot see an empty line to add new data.
the form property allowaddition is on
the recordsource of the form is an sql View to which I can add a new line directly from access (so it is not readonly)
I am forcing the AllowAddition on the code when initializing security with me.allowadditions = true (this used to be enough to make it work in the old adp)
I have a button to add a new line to the form that runs on_click and gives me a runtime error on this line of code Docmd.gotorecord , , AcNewRec
The runtime error is "2105 : you can't go to the specified record".
This tells me that there is something that is still read only.
the SQL View has an index as well as all the table used in it.
I tried to replace the view in the recordset of the form by a table and still not working.
Am I missing something? What else can I do to be able to add a new record to my form (or view)?
Thank you
Try setting focus to one of the textbox controls in your form before calling the new record, something along the lines of
me.txtControl.SetFocus
The reason is, SQL Server backend allocates new records differently than Access backend, and Access does a bit of magic for you in the interface, so I've found sometimes explicitly setting focus to a text control will fix this issue.
Depending on how things are structured with your Access app, if that suggestion doesn't work, then you might need to go the extra step of programatically creating the new record (blank fields except for primary key) in SQL Server first and then refresh the Access form and then setfocus to the newly created record (e.g. either the last or first record depending on your recordsource sort order)

How to detect if an ASP ComboBox is blank.empty

I have an ASP ComboBox that is populated on page load with a list of information and a selected index is set. I want the user to be able to type a new value into the box and run a routine that saves that value.
So far, I've managed to set it so when you run the save routine it can detect the text of the box using;
cboFreeBody.SelectedItem.Text
If the box loads with 'arm' and I change it to 'leg', when I run my routine it grabs the new value and processes it, however if I delete 'arm' and leave it blank when I run the routine the above code returns 'arm', where I'd expect it to return ''.
I'm sorry if I haven't explained myself fully here, I'm rather new to ASP and VB.NET so I'm probably just splurting useless information here, but any help would be greatly appreciated.
I ma not sure but thats might help you..
If com_box.SelectedItem = vbEmpty Then
MsgBox("its empty")
End If
I use the isnullorwhitespace function usually.
if string.isnullorwhitespace(cboFreeBody.SelectedItem.Text) then
else
end if

c# asp.net report and sub report in report viewer (or reportviewer)

I did all the steps from this waltrought:
http://blogs.msdn.com/b/sqlforum/archive/2011/01/03/walkthrough-add-a-subreport-in-local-report-in-reportviewer.aspx
and when i run it i get the first father report and instead the sub
report i get:
Data retrieval failed for the subreport, 'Subreport5',
located at: C:...
i attach a print screen file
i am using VS2010 framework 3.5.
Can you run the subreport by itself, given the right parameters? If you can't, your problem is that.
If you can run it successfully by itself, double-check that you are passing the parameters correctly to your subreport. Make sure the parameter types match and that you are passing all of them.
Another problem might be that -- if I recall correctly -- when you have a subreport in a local report, you need to provide the data for the subreport programmatically, just as you do with the parent report. There's an event that's raised - SubreportProcessingEvent -- when the subreport is being processed. You write a handler for that event and supply data in the handler. Here's some more information about it: LocalReport.SubReportProcessingEvent. There's a good example on that page.

"Missing Parameter Values" error on moving to next page of report

I am writing a web application using ASP.NET 2.0 [Visual Studio 2005 Professional Edition].
I have a Crystal Report that is connected to a stored procedure residing in SQL Server. This stored procedure accepts a parameter and therefore I have a formula in my report's hyperlink section to pass the parameter via Query String.
Everything works fine except when I click the navigation buttons to move to the next page of the report, I either get an error or Crystal Reports shows an input box to enter the parameter values.
The error shown is: "Missing Parameter Values". Only this error is shown and nothing else. If I try to export the report by selecting Export option on the Crystal toolbar, it opens a page and asks for the parameter values.
I am not following why parameter values disappear when either I move from the first page to the other or try to export the report?
Most likely you are setting the parameters in the report viewer instead of the report object. If the parameters are set in the report object they should persist on navigation. If you still have issues create an event handler for the report viewer's 'Navigate' event and reset them.
Aditionally, if you call report.Refresh() or report.VerifyDatabase() after you set parameters it clears the values so be aware of that,
MD
When we click on report navigatin button, print button page is refeshed and we facing with 'missing parameter values error '
My probem is solved by using below line of code.
If Not Page.IsPostBack Then
CrystalReportViewer1.ParameterFieldInfo = paramFields
CrystalReportViewer1.ReportSource = myReportDocument
CrystalReportViewer1.DataBind()
Else
CrystalReportViewer1.ReportSource = myReportDocument
CrystalReportViewer1.DataBind()
End If
where paramFields are runtime created ParmeterFields
Best Regards,
Vinay Shukla

Resources