Data sources empty on ReportViewer - winforms

I'm trying to link up my report viewer to the data sources, however the dialog box is empty -
I have a file called dsReports.xsd which has data sets that work when I preview data from there.
Anyone know why this could be?
Thanks

I have got round this by programatically setting the data source -
var myDataTable = new dsReports.tsPrimaryMondayDataTable();
var myTableAdapter = new dsReportsTableAdapters.tsPrimaryMondayTableAdapter();
myTableAdapter.Fill(myDataTable, Convert.ToDateTime(dtp.Value));
var rds = new ReportDataSource("DataSet1", myDataTable as DataTable);
reportViewer1.LocalReport.DataSources.Clear();
reportViewer1.LocalReport.DataSources.Add(rds);
reportViewer1.RefreshReport();

This problem occur when yourfile.rdlc not have add a DATASET like "source data". Then, add a table in your report .rdlc and configure the after try add datasource in rsweb:ReportViewer dont forget of put a ScriptManager a .aspx.

The problem is that you probably save your report with newer version of Visual Studio (in my case with Visual Studio 2019). After save, the data source list will be empty in the "Choose Data Sources" section.
When I edit my original report with older version of Visual Studio the data source list shown.
(in my case a saved report cannot be restored neither with older version of VS, so I hope you have a backup :) )

Related

msadox28.tlb is not a valid .Net assembly file while registering it

I am developing application with vb.net (2015) and MS Access database. I can work fine with existing database. I have now situation where I need to create database programmatically, for billing purpose. It is the situation where each folder will contain database for company/firm selection.
After searching on the internet / StackOverflow I learned about ADOX. Even got the ready code for it. I applied it in my coding.
Adding reference of Microsoft ADO extend 2.8 and 6.0
Created variable Adx as new Adox.catalog
Then finally wrote Adx.create(olejet provider conn string with data source)
In this step I get an error
COM Class not registered
So I tried to register msadox.dll and msadox28.tlb with regsvr32 and regasm but at that time I get another error:
msadox.dll get registered successfully but error gives in msadox28.tlb
Fail to load -file- becuase it is not a valid .net assembly file
Now I am stuck at this point.
My system is Windows 10 64 bit. I tried to target cpu x86, and any cpu but it didn't work. I got many questions and answer here but didn't understand it.
EDIT:
I tried following connection string and it worked, but it creates old 2000-2003 mdb file. i want to use new access file .accdb
String is :
Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\VBProj\Testing\test.mdb;Jet OLEDB:Engine Type=5
EDIT : on 20/9/2021 - MON
First of all Thank you very much #Jimi, your suggestion to use ACE.16 and cleaning solution worked. Thanks a lot
I use the following steps to create MS Access database using ADOX in VB.NET:
Project Menu > Add Reference > COM Section > Select Microsoft ADO Ext. 6.0 for DLL and security
Write connection string at program entry point (form load/sub main) -> Provider=Microsoft.ACE.OLEDB.16.0;Data Source=D:\VBProj\Testing\test.accdb, assign it to variable connString
Declare adox catalog globally like Public gAdxCat As New ADOX.Catalog
Use its method gAdxCat.create(connString)
That's all - DONE
Again thanks to #jimi
This is the answer to my question (helped by #jimi)
following are the steps to create msaccess database using ADOX in VB.NET and error occurs mention in original questions.
1-Project Menu > Add Reference > COM Section > Select Microsoft ADO Ext. 6.0 for DLL and security (remove ref of 2.8)
2-write connection string at program entry point (form load/sub main) -> "Provider=Microsoft.ACE.OLEDB.16.0;Data Source=D:\VBProj\Testing\test.accdb" assign it to variable connString
3-declare adox catalog globally like Public gAdxCat As New ADOX.Catalog
4-User its method gAdxCat.create(connString)
5-Thats all DONE
again thanks to #jimi

Could not get type information for app.dataset

I've been stuck on this issue for some time now, i have connected to to an Azure database then created a dataset by adding a new data source.
But whenever i try to preview the data in one of the tables this error messeges
Could not get type information for app.dataset
The error message pops up whenever that dataset is created, and this error message pops up when i run this code
var q = (from ev in db.Events
where ev.Id != 0
select ev.Title).First().ToString();
string e = q;
tv.Text = e;
Sequence contains no elements
Any help is appreciated
I had the same kind of problem with Visual Studio 15 and a regular SQL server. The Connection string was stored in my settings file. I had copied the file from another project and made small adjustments to it.
Deleting the copied settings file and creating a fresh one solved the problem. Apparently some incorrect data was copied also, even tho the settings file looked just fine.

var data = Database.Open("databasename").Query("SELECT * FROM table); visual studio

I know you can do this in web matrix and it works fine
var data = Database.Open("databasename").Query("SELECT * FROM table); visual studio
but how can you achieve something similar in visual studio 2010 using MVC3???
I need to be able to loop through table rows using a foreach() and implement them through an api, I originally started the project in web matrix, but was asked to use mvc in visual studios instead, i have limited knowledge with it. I am using Microsoft sql server.
Also if anyone thinks I might be going the complete wrong way about achieving this, any input to point me in the right direction would be appreciated.
I've found that the ORM which most closely resembles WebMatrix is Dapper.
https://github.com/StackExchange/dapper-dot-net
It can be used with dynamic objects in a very similar manner to WebMatrix, but can also be used with strongly typed objects if you wish. It's available as a NuGet package.
The code in your question would end up looking something like the following in Dapper:
using (var con = new SqlConnection(WebConfigurationManager.ConnectionStrings["databasename"].ConnectionString))
{
var data = con.Query("SELECT * FROM table");
foreach (var row in data)
// do stuff
}

data source for report viewer control in WPF

I have a ReportViewer control in a WindowsFormsHost tag in my WPF application. When I use this code:
rptViewer1.LocalReport.ReportPath = ...
List<ReportParameter> parms = new List<ReportParameter>();
parms.Add(new ReportParameter("regionID", "01"));
rptViewer1.LocalReport.SetParameters(parms);
rptViewer1.RefreshReport();
I get an error about a data source instance not being supplied. I can run the stored procedure manually and then use it to populate a datasource object, like...
var dt = DAL.GetData()
var rds = new ReportDataSource("DataSet1", dt);
rptViewer1.LocalReport.DataSources.Add(rds);
And this will cause the report to display, but then I am passing in my parameters to the GetData() method rather than to the report; this doesn't seem right. In my SSRS project, I am using a shared datasource, and it allows me to pass in the parameters on the report front end as I would expect. What am I doing wrong?
If you are using ProcessingMode = Local, then YOU are responsible for large portions of teh report. You or your application defined which parameters there are, how data is loaded, & what sub-report or drill through events do. You must explicitly code these. If the ProcessingMode = Remote, then all of these elements are handled by the reporting server. Microsoft doesn't spell this out very clearly in MSDN, but I can see their justification being "if you are going to host the report in your app, then you can be responsible for all the details".

Can't get rid of a deleted Settings reference in DataSet.Designer.vb

I had a connection string to a MS Access DB file, Foo.accdb, defined and used in my project. It was defined as a connection string Setting in the Settings section of my project properties. The program referenced the connection string setting and everything worked fine.
Then I decided to replace Foo.accdb with two different DB files, A.accdb and B.accdb each of which would be used under different circumstances. I added connection strings for them in Settings and removed the Setting definition for Foo.accdb connection string.
The name of my application is Foo and the name of the Foo.accdb connection string was FooConnectionString.
But now when I build the program both in debugger and for release I get the following error message:
'FooConnectionString' is not a member of 'Foo.My.MySettings'.
The offending reference, in file FooDataSet.Designer.vb, is:
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Private Sub InitConnection()
Me._connection = New Global.System.Data.OleDb.OleDbConnection
Me._connection.ConnectionString = Global.Foo.My.MySettings.Default.FooConnectionString
End Sub
What is going on here? FooConnectionString is not in any other file in the project directory nor in the My Project subdir. I completely got rid of it in my code and in my project properties yet it persists in FooDataSet.Designer.vb (whatever that is).
While researching this on the web I saw a recommendation to select the FooDataSet.xsd file, right click it and execute the "Run Custom Tool" option. I did this and it appears to rebuild FooDataSet.Designer.vb (the time stamp changes) but the problem persists.
I also tried removing the offending reference by manually editing FooDataSet.Designer.vb but that gave me some other error message.
Why is this old reference staying around and what can I do about it?
This is a standalone app. I'm using VS2008 Standard Ed., VB.Net 3.5
Thanks.
Open the FooDataSet XSD file in a text editor. Right click on dataset in the solution explorer and select "Open With..." and the select XML (text) Editor or open it outside the solution.
Look for the <Connections> tag near the top of the file. Remove the line that looks like this
<Connection AppSettingsObjectName="Settings" AppSettingsPropertyName="FooConnectionString" ConnectionStringObject="" IsAppSettingsProperty="true" Modifier="Assembly" Name="FooConnectionString(Settings)" ...

Resources