Web Application with X#

This forum is meant for examples of X# code.

Post Reply
User avatar
softdevo@tiscali.it
Posts: 191
Joined: Wed Sep 30, 2015 1:30 pm

Web Application with X#

Post by softdevo@tiscali.it »

Hello everyone, this message of mine is intended to stimulate programmers in X # to try to write web applications with our language.
Attached a PDF with which I show how it is possible to realize applications retrieving code written years ago in VO for desktop applications.
I used ASP.NET pages to realize the interface, DLLs in X # for logic and functionality, JavaScripts for interaction with the user, Mysql as a database.
Interesting the possibility to debug the application with Visual Studio and inject JavaScript code into the X # code.
I remain available to help anyone in need.
good job
Attachments
English_Demo.pdf
(985.19 KiB) Downloaded 89 times
ic2
Posts: 1858
Joined: Sun Feb 28, 2016 11:30 pm
Location: Holland

Web Application with X#

Post by ic2 »

Hello Danilo,

This is very interesting and also it looks very good what you created. We have a couple of CGI web programs (= a VO exe 'constructing' HTML output). They work fine but moving it to ASP gives us more flexibility; not every ISP allows .exe files to run on a server.

We would also need to use MySQL instead of DBF. We do have some mixed environments: DBF + MySQL. Problem is that from time to time MySQL servers tend to fail for a while. Currently it means that all transactions done are stored in a DBF and they are simply retried so don't get lost. Even if we move all DBF actions to MySQL, which is far less work for our webapps than it is for our Pc/server programs, I would like to have a DBF access option for backup purposes.

But I assume that won't work on Windows (ASP) web servers, right?

Dick
User avatar
softdevo@tiscali.it
Posts: 191
Joined: Wed Sep 30, 2015 1:30 pm

Web Application with X#

Post by softdevo@tiscali.it »

Excuse me, I do not understand your question well, I work with asp.net pages that inherit it from the class whose methods are contained in DLLs written in X #

Danilo
ic2
Posts: 1858
Joined: Sun Feb 28, 2016 11:30 pm
Location: Holland

Web Application with X#

Post by ic2 »

Hello Danilo,

I work with asp.net pages that inherit it from the class whose methods are contained in DLLs written in X #

Yes, I understood that. I've written 2 .Net ASP apps in C#, but using X# for it means we can transport VO code which saves a lot of time.

What I also wonder is: could you use dbf files on a web server, using X#? I remember that was a problem because web servers will be 64 bit while the VO/Vulcan DBFCDX drivers are 32 bit. Correct?

Dick
User avatar
softdevo@tiscali.it
Posts: 191
Joined: Wed Sep 30, 2015 1:30 pm

Web Application with X#

Post by softdevo@tiscali.it »

You could use this technique:

LOCAL oRemoteDS_DBF AS System.Data.OleDb.OleDbConnection
LOCAL oFile AS System.IO.FileInfo
LOCAL oServer AS System.Data.DataTable
LOCAL cFile AS STRING

cFile := "C:MYAPPMYDBF.DBF"

oFile := System.IO.FileInfo{cFile}
oRemoteDS_DBF := System.Data.OleDb.OleDbConnection{"Provider=Microsoft.Jet.OLEDB.4.0;"+;
"Data Source="+oFile:DirectoryName+";Extended Properties = DBASE III"}
oRemoteDS_DBF:Open()

oServer := ExecuteSelect_Dbf(cQuery,oRemoteDS_DBF)

oRemoteDS_DBF:Close()
oRemoteDS_DBF := NULL_OBJECT

RETURN oServer

FUNCTION ExecuteSelect_Dbf(cQuery AS STRING,oRemoteDS_DBF AS System.Data.OleDb.OleDbConnection) AS System.Data.DataTable
LOCAL oDataTable AS System.Data.DataTable
LOCAL oDataAdapter AS System.Data.OleDB.OleDbDataAdapter
LOCAL oDataSet AS System.Data.dataset
LOCAL oCommand AS System.Data.OleDb.OleDbCommand

TRY
oCommand := oRemoteDS_DBF:CreateCommand()
oCommand:CommandText := cQuery
IF Left(Upper(cQuery),6) == "SELECT"
oDataSet := System.Data.dataset{}
oDataAdapter := System.Data.OleDB.OleDbDataAdapter{oCommand}
oDataAdapter:MissingSchemaAction := System.Data.MissingSchemaAction.AddWithKey
oDataAdapter:Fill(oDataSet,"MyTable")
oDataTable := oDataSet:Tables:Item[0]

oDataAdapter:Dispose()
oDataAdapter := NULL
oDataSet:Dispose()
oDataSet := NULL
ELSE
oCommand:ExecuteNonQuery() //Execute e query //
ENDIF
CATCH Errore AS System.Exception
MessageBox.Show("Error: "+Errore:Message,,"Error")
FINALLY

oCommand:Dispose()
oCommand := NULL_OBJECT
END TRY

RETURN oDataTable
Post Reply