C# code for Grid to FoxPro DBF (free table) - c#

What is the easiest way (without installing extra drivers) to open a FoxPro DBF table and link it to a DataGrid in WPF?

I guess this as nothing do do specificaly with WPF. You can link almost any .net collection/data collector object to WPF data grid.
But your problem stands way before that and concerns .net data access in general. You should remove the WPF tag from your question and rather see what ADO. net can do for you.
Once this is done and that you have the content of your FoxPro db in a .net collection, then you will worry about WPF ;)

i don't think this is possible without driver installation. see this question.

There are ways to do it without installing new drivers but none if them are easy.
You could inspect the table at the file level - the structure is documented here: http://fox.wikis.com/wc.dll?Wiki~TableFileStructure
Or you could write a VFP exe that you can run from your C# code that dumps the table to XML. See the CURSORTOXML function for more details.
Written on my iPhone.

Do you know how to use basic ADO.Net to connect to a FoxPro DBF table and create a Typed DataSet? That's the first step you've got to get working. From there, the task becomes binding a WPF DataGrid to a Typed DataSet.

Related

How to connect to LocalDB in a .NET 5 project?

I am writing a console application using .NET 5, and I am using a LocalDB instance (at least I hope that's the right terminology) to store the data that the application needs. I can see the database (including both tables and all the data in said tables) in both the Server Explorer and SQL Server Object Explorer tabs of Visual Studio 2019, but the Data Sources tab the only thing that shows is the text "This window is not supported for the selected project."
The problem is, all the tutorials I've been able to find rely on that Data Sources tab. From looking at other questions here on Stack Overflow, it looks to me like that tab is deprecated with .NET 5? Am I correct? And how would I write the code to access the database and perform CRUD operations without the Data Sources tab?
Sorry if this is a stupid question; this is my first time using LocalDB.
You should use SQL Server Object Explorer. If you right click on the database that you want to connect, you can see the properties, including connection string. If you have trouble with incorporating Connection string into your code - you need to show the code and the problem.
Whether Data Sources is deprecated or not, as you can see it is not supported for most projects (I think it's just for Windows projects - but I may be wrong). Anyway - you don't need it. And by the way - this approach works regardless of the database you use (LocalDB, SQL Express or regular SQL Server)

Using a local database

I'm busy writing a small app and I only want a database to load small amounts of data, in other words I don't need the functionality of SQL.
So I've installed filehelpers, but it seems very limited in the sense that I can read/write and even append data, but it seem impossible to delete one row of data in a table?
Does anyone know how to do this with filehelpers or point me to a different solution where I can just add a local db to my app without any other external software required?
PS. My visual studio does not have the "create local db" from the item selection.
For something like this, I'd use an embedded SQLite database. It gives you the best of both worlds, one file database for local data and most of the features of SQL.
See here: https://sqlite.org/
On their download page, they have lots of stuff and a plugin for VS:
https://sqlite.org/download.html

Program a Data source (Visual Studio) alike in C#

I'm trying to develop a data source alike (visual studio). I have the interface all done already(easy part), but the trickies parts of this projects are:
1 - I need to populate the data source according to what the user has installed on his(her) computer, meaning that, if he doens't have Oracle, the tab won't show. -> That's the part I'm having difficult.
The binding part, I have a sketch, using ifs (or switchs) using the text in the data source field.
I'm using DevX in the interface !
Any ideas ?
Thanks
As there is no .NET API to get the list so you have to work with Windows registry to find the list.
Here is good tutorial on finding datasource name.......

How do I build a c# treeview from SQL Hierarchyid?

I'm developing an C# .NET Windows Form application that 'll manage a hierarchical tree-view structure. (I have a single SQL table with a hierarchyid column. The data set is small ~300 rows/nodes at the moment, but is bound to grow large eventually)
After I exit the application, I want to be able to restart it with the last modified state. I understand I can do this by serializing it to XML.
However, I'm trying to find a method by which the treeview could be generated directly from the table at run time, using the hierarchy id column.
After Googling around, I've found some others who wish to the same, but unfortunately I've found no solutions. Is there a good way to do this?
Thanks.
Look for IHierarchicalEnumerable, HierarchicalDataSourceControl and HierarchicalDataSourceView. Thats exactly what are you looking for.

How to make a quick interface to edit / delete / add the database?

I have the database mysql.
I need to access it via a desktop application with the ability to change does not have value.
in asp.net is there, this dynamic data filter, I need the same thing but in WPF.
Visual Studio has lots of easy tools to help you integrate your SQL Server into the application from using things like the DataGridView to the DataRepeater take a look at this article http://www.codeproject.com/KB/WPF/wpfviews.aspx it should help you get started. Using LINQ to assist in speed application development.
Another Great link: http://dotnetslackers.com/articles/wpf/WPFDataBindingWithLINQ.aspx

Categories

Resources