fbpx
Welcome, Guest
Username: Password: Remember me
Share your code snippets, screen shots etc. here
  • Page:
  • 1

TOPIC: A 'First' for xBase - code creating a full SQL database !?

A 'First' for xBase - code creating a full SQL database !? 2 years 3 months ago #1

  • Phil Hepburn
  • Phil Hepburn's Avatar Topic Author
  • Offline
  • Posts: 737
  • Karma: 7
Hi Robert, and all guys,

This is just a short post to introduce the fact that yesterday I managed to do in xBase what I had successfully done some six years ago in C# - that is have the code of my X# app create a new SQL database with multiple Tables, and then immediately populate those tables with test data. Everything done from code and in VS - because I am using WPF for a small form.

I will post much more here as I still need to do further tidying and improving work today. I am also writing the eNotes for Cologne as I am doing the development, so this takes a bit extra time.

It is my intent to try and post a link from a shared 'OneDrive' folder of mine, so that you can download and run the code yourselves, on your PC. As long as you have a "C:\Temp" folder on your system.

Yes, the L2S (LINQ to SQL)app currently drops and recreates the database each time it is run, adding the test data items just afterwards. Its all quite easy to do, not difficult to understand, BUT, like a lot of data stuff is a bit tricky to get right ;-0) Many little places where it can go wrong!

Attached / below is the result of this current test app in Management Studio - three tables Customer, Invoice, Product. I have included a shot of the Customer test data in image '_02'.




Hope this interests a few of you guys - this is all part of going to Entity Framework - L2S is good practise for EF6/7 apps.

Regards,
Phil.
Attachments:

Please Log in or Create an account to join the conversation.

A 'First' for xBase - code creating a full SQL database !? 2 years 3 months ago #2

  • wriedmann
  • wriedmann's Avatar
  • Offline
  • Posts: 1423
  • Karma: 6
Hi Phil,

actually I have finished something also for Firebird - my choice for a SQL database because it is free, powerful and available on Linux and Windows - even a "all-contained" solution for a single user database is available, completely configuration free.
My code even checks the current table structure and adds/modifies missing/changed fields.

Unfortunately I had to write code specific to Firebird....

If someone is interested, I can make a working sample.

Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
This email address is being protected from spambots. You need JavaScript enabled to view it.
www.riedmann.it - docs.xsharp.it

Please Log in or Create an account to join the conversation.

A 'First' for xBase - code creating a full SQL database !? 2 years 3 months ago #3

  • Phil Hepburn
  • Phil Hepburn's Avatar Topic Author
  • Offline
  • Posts: 737
  • Karma: 7
Hi Wolfgang,

Sounds good, do you use LINQ at all in your solution ?

And do you use X# in your coding for this ?

I am not familiar with Firebird - what exactly is it ?

The main point I was making was that with ONLY X# code I could design and create the SQL database, as well as seeding it with suitable test data. And that LINQ was key to doing this.

Good Luck and speak soon,
Phil.

Please Log in or Create an account to join the conversation.

A 'First' for xBase - code creating a full SQL database !? 2 years 3 months ago #4

  • wriedmann
  • wriedmann's Avatar
  • Offline
  • Posts: 1423
  • Karma: 6
Hi Phil,

Sounds good, do you use LINQ at all in your solution ?


no, plain SQL.

And do you use X# in your coding for this ?


yes, of course! Since Robert has added some new language features to X# specially for my needs, I have removed all C# code.

I am not familiar with Firebird - what exactly is it ?


Firebird is a full blown opensource SQL server. It is a descendand of Borlands Interbase.

firebirdsql.org

Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
This email address is being protected from spambots. You need JavaScript enabled to view it.
www.riedmann.it - docs.xsharp.it

Please Log in or Create an account to join the conversation.

A 'First' for xBase - code creating a full SQL database !? 2 years 3 months ago #5

  • Phil Hepburn
  • Phil Hepburn's Avatar Topic Author
  • Offline
  • Posts: 737
  • Karma: 7
Hi Wolfgang (and all),

Just so that the other guys are aware, the reason I posted the original message about a 'first for X#' was not the connection to the SQL database itself - we could do that with ADO.NET in Vulcan over 7 years ago - it was the fact that all the communication with the SQL database 'engine' was done using compiled X# code. From the very creation of the DB through to its Table creation and population, and subsequent data retrieval querying.

Sending a character string through to the DB engine (for us) is what the technology is all about - any T-SQL statements sent to the DB Server have all been composed 'under-the-hood' by the Microsoft LINQ to SQL (L2S) technology, and that is VERY clever.

So all our stuff has the benefits of compiler checking, and us using data types which are .NET types, etc., etc.. Effectively, the SQL engine is hidden from view to us developers. All we need is a certain level of understanding as to how the SQL Server works.

I hope this makes some sense to most folks ;-0)

And don't forget it, we are really aiming to get to 'LINQ to Entities' with X# quite soon ;-0) With EF6/7 we can do more business like 'stuff' (Entities) and also the back-end data source can be other than MS SQL Server.

Regards,
Phil.

Please Log in or Create an account to join the conversation.

A 'First' for xBase - code creating a full SQL database !? 2 years 3 months ago #6

Hi Wolfgang,

I'm in the middle of migrating my DBF database to SQL.
I would be very interested in seeing a sample.
Thank you.

Giuseppe

Please Log in or Create an account to join the conversation.

A 'First' for xBase - code creating a full SQL database !? 2 years 3 months ago #7

  • wriedmann
  • wriedmann's Avatar
  • Offline
  • Posts: 1423
  • Karma: 6
Hi Giuseppe,

I'll put together a small sample the next week.

Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
This email address is being protected from spambots. You need JavaScript enabled to view it.
www.riedmann.it - docs.xsharp.it

Please Log in or Create an account to join the conversation.

  • Page:
  • 1