Create AX SSRS Report with stored procedure in Dataset - stored-procedures

I want to create a SSRS Report for Microsoft Dynamics AX 2012.
I created a DataSource to a SQL Server and now I want to create a dataset with DataSourceType = "Stored Procedure".
The problem is in Visual Studio (2010) I do not have the option to set the DataSourceType to "Stored Procedure" in the properties window and I don't know why.
Click here to see a Screenshot from the Properties Window
Does anybody have any idea?

Make sure the Provider property of the ReportDatasource is set to SQL.

Related

Delphi / Rad Studio 10.4 - TSimpleDataSet: cannot expand Connection and DataSet property

when I use a TSimpleDataSet, the IDE cannot allow me to expand Connection and DataSet property.
See the image below. I don't have the arrow to expand properties but only on Connection and DataSet.
Please give me support!
Your project needs to contain a TSqlConnection component before you can set the Connection property of a TSimpleDataSet.
Do this:
Start a new VCL project.
Add a TSqlConnection and a TSqlQuery to the form.
Configure the TSqlConnection to access a Sqlite database on your system.
Set the SqlConnection of SqlQuery1 to SqlConnection1.
Now ...
Add a TSimpleDataSet to the form.
Set the Connection property of SimpleDataSet1 to SqlConnection1. This answers your first point.
Notice that you still can't change the DataSet property of SimpleDataSet1. That's working as designed, because it is only supposed to use this internally-created dataset.
Open the DataSet property of SimpleDataSet1 and set its CommandText property to do a SELECT query against one of the tables in the Sqlite databaase.
Set SimpleDataSet1.DataSet.Active to True. That'h how you use TSimpleDataSet's DataSet property.
Next, see https://docwiki.embarcadero.com/RADStudio/Sydney/en/Using_TSimpleDataSet and https://docwiki.embarcadero.com/Libraries/Sydney/en/SimpleDS.TSimpleDataSet.

How to use Microsoft Access In your login form for delphi

OK, so I am a self taught basic coder by watching videos on how to do basic coding with Delphi and i have successfully created an application where i use a text file for a login form with usernames and passwords being checked (with a lot of help from videos). How can i use Microsoft Access for the login for the username and a password? I struggle to find a video on how it works. I found a video telling me how to connect ado tables and connections, but i am struggling with the login. Any help would be appreciated.
If you can follow the video about Ado tables, all you are missing is how to configure the TAdoConnection you use to connect to the database. Assuming you've got the project set up:
In the IDE, click your TAdoConnection - usually it would be called AdoConnection1 by default.
In the Object Inspector, click AdoConnection1's ConnectionString property.
In the Data Link properties pop-up, select the MS Office 12.0 Access Database Engine OLE DBProvider (the version number may be different on your system), then click `Next'.
On the next tab, in item 1, enter your database's exact name and extension, including the full path to it.
In item 2, enter the User name
Then click Test connection. Assuming you get Test connection succeeded, you're done.
Try that and see how you get on.
Btw, very occasionally you may come across Delphi Ado projects that don't have a TAdoConnection; in that case, you configure the connection of the TAdoDataSet component (e.g. a TAdoTable) by the above method.
If you would prefer to start with a blank form and set it up from scratch yourself, do the following before the above steps:
Place the followinng components on the form: a TAdoConnection; a TAdoTable; a TDataSource (on the Data Access tab of the Component Palette); a TDBGrid and a TDBNavigator (both on the Data controls tab. Then wire them up as follows:
In the Object Inspector set the DataSource properties of DBNavigator1 and DBGrid1 to DataSource1
Set DataSource1's DataSet property to AdoTable1
Set AdoTable1's Connection property to AdoConnection1
Then, configure AdoConnection1 as detailed above.
Finally
Set AdoTable1's TableName property to the name of a table in your database, thn set its Active property to True.
Compile and run.
Once you've got it working, set AdoTable1's Active property to False and instead set it to open in Form1's FormCreate event. You can also set AdoConnection1's LoginPrompt to False if you prefer.

Run-time Equivalent to Assign Local Data... for TClientDataSet and TSQLQuery

The TSQLQuery class is unidirectional, so for it to be used as a source for a data-bound TDBGrid, a TClientDataSet needs to be linked between the TSQLQuery and the TDataSource that the TDBGrid is bound to.
I can connect the TSQLConnection and make the TSQLQuery active at design-time, with specified params, and then I can right-click on the CDS and choose the "Assign Local Data..." option to have it grab the data from the TSQLQuery, which then appears in the TDBGrid via the linked TDataSource.
The amount of time between choosing "Assign Local Data..." and the data actually appearing in the grid is very short, so I am looking for the way to replicate this at run-time.
Supposedly, I can set the Data property of the CDS to the Data of the source, but a TSQLQuery has no Data property. There was a post about using a provider, but
DataSetProvider1.DataSet := SQLQuery1;
ClientDataSet1.Data := DataSetProvider1.Data;
throws an access violation,
I did implement the data copy by looping through the TSQLQuery and appending the records to the TClientDataSet, but that was a lot slower than the "Assign Local Data...".
[Edit 1]
All the components I need are hooked up at design-time, and I can make the TSQLConnection active, then the TSQLQuery, then the TClientDataSet and the TDBGrid displays the data from the parameterised query defined in the TSQLQuery.
In the OnChange event of a TComboBox, I need to refresh the query using a different parameter and have the grid show the relevant results, so I Close the TSQLQuery, change the ParamByName value, Open the TSQLQuery and then call ClientDataSet1.Last to highlight the last row in the grid.
That gives me a "Cannot perform this operation on a closed dataset" error, so I use
ClientDataSet1.Active := true;
but that throws an "Access Violation".
All the examples I can find are all about dropping components onto a form, linking them together, and they work. Well, yes they do, but I need to change properties in code at run-time and still have it work, which it just refuses to do.
This is really beginning to frustrate me.
[Edit 2]
So I followed the example on the Embarcadero site for building a VCL Forms dbExpress Database Application, substituting my database connection details for the Interbase one the example uses.
http://docwiki.embarcadero.com/RADStudio/Tokyo/en/Building_a_VCL_Forms_dbExpress_Database_Application
In the designer, everything looked fine and the grid was showing the results from the query, but when I went to run it using F9, I was getting an "Access Violation" thrown from within TCustomClientDataSet.InternalCheck.
Turns out this is a known MIDAS.DLL versioning problem and can be resolved by including MIDASLib in the uses clause of the form. It is just unfortunate that the Datasnap.DBClient code is still throwing Access Violations instead of proper messages, especially since this problem was reported in 2013.
You can use this code. Just change TUniConnection and TUniQuery to what You are using:
Procedure CdsAssignTable(aTableName:String; aCds : TClientDataSet; aCon
:TUniConnection );
Var
aQUery : TUniQuery;
aProvider : TDataSetProvider;
begin
if aCon=Nil then raise Exception.Create('aCon=Nil');
if aCds=Nil then aCds:=TClientDataSet.Create(aCon.Owner);
aQUery:=TUniQuery.Create(Nil);
aQUery.SQL.Text:='select * from '+aTableName;
aQUery.Connection:=aCon;
aQUery.Open;
aProvider:=TDataSetProvider.Create(Nil);
aProvider.DataSet:=aQUery;
aCds.Data:=aProvider.Data;
FreeAndNil(aProvider);
FreeAndNil(aQUery);
End;

Create a .mdb without MS Access or ADOX

I'm using dephi 2010, which is getting difficult with me about installing the ADOX components. So I was wondering if there is a way to create a .mdb file without the use of the ADOXCatalog.
-Thank you.
Yes, this can be done without using an ADOXCatalog.
Place a TAdoConnection and e.g. a TAdoCommand on a form or datamodule. Set the TAdoCommand's Connection property to the TAdoConnection.
Then, in the AdoConnection's ConnectionString builder, select Microsoft OLE DB Driver for ODBC. Then, follow the ODBC wizard to set up a new MDB database. As you follow that through you will be able to create a File DSN (unless you are running Delphi as adminstrator), select the Access Jet driver, specify the database path (making sure it is somewhere writeable) and name, and then the wizard presents you with a button to click to create the MDB file.
Although it is not in English, there is a video here
https://www.youtube.com/watch?v=E_2hrER9oho
which shows you exactly how to do this. The ODBC connection string wizard should give you the option to create a new datasource and present you with a list like this to choose from:
Set the TAdoCommand's CommandText to something like
create table ATable (AName TEXT(40))
and call its Execute method at r/time to create a one-column table.
Btw, you could equally well use a TAdoQuery instead of the TAdoCommand component using its Sql property instead of the TAdoCommand's CommandTextproperty, and you should be able to use any valid DDL statements to define the tables in the database.

TFS Version Control Item extensions

is it possible to extend a TFS Version Control Item with custom fields or properties?
Most entries found are about custom properties on TFS Work Items.
I want to keep a version control Item linked to a record in a database, using a set of custom properties that contain the db/table/primary key of the record.
Thanks, Rine
Team Foundation Server 2010 introduced a new feature called 'Properties'. Almost every item in TFS, be it a version control file/branch, or a work item can have a property bag associated with it.
What is missing from TFS 2010, is a generic UI to view/set these properties, however you can use the TFS Object Model to view/set them yourself.
For more information, see the following links:
Adding Properties to Artifacts within TFS 2010
Using the TFS Property Service to enrich your third party VS tools
MSDN documentation for Microsoft.TeamFoundation.Framework.Client.IPropertyService.
You delete a property by setting its value to null.
public static void DeleteGenericProperty( this IPropertyService propertyService,
string moniker, string propertyName, int version = 1 )
{
var artifactSpec = new ArtifactSpec(ArtifactKinds.Generic, moniker, version);
propertyService.SetProperty(artifactSpec, propertyName, (string) null);
}

Resources