Mysql CREATE VIEW Option

A forum devoted to the discussion of all topics having to do with scripting and other advanced programming using iX Developer.
Post Reply
Briooosa
Posts: 1
Joined: Fri Oct 25, 2019 3:50 am

Mysql CREATE VIEW Option

Post by Briooosa »

Hello,

I am trying to do a search on multiple Dataloggers for data, and then show the result in a Databaseviewer that i creat for each datalogger.

...
//---------------------------------------------------------------------------------------------------------------------
sqlConnection.Open();
string query_1 = "SELECT COUNT(*) FROM DataLogger1 where NumOP = '" + Globals.Tags.n_search.Value + "'";

using (var command = new SQLiteCommand(query_1, sqlConnection))
using (SQLiteDataReader reader = command.ExecuteReader())
{

reader.Read();
MessageBox.Show("Count query_1 is: " + reader.GetValue(0).ToString());
Globals.Tags.i_1.Value = reader.GetValue(0).ToString();
}


sqlConnection.Close();
sqlConnection.Dispose();
}



string query2_1 = "SELECT * FROM Datalogger_1 where NumOP = '" + Globals.Tags.n_search.Value + "' ORDER BY COMPA DESC LIMIT 3";

if (Globals.Tags.i_1.Value != "0" )
{


MessageBox.Show(query2_1);
DatabaseViewer1.SendSelectQuery(query2_1,"Database.db");


}

//---------------------------------------------------------------------------------------------------------------------

My question is if it's possible to use the CREATE VIEW mytest Select * From Datalogger1 UNION Datalogger2...and the run the search query and show the result in only one databaseviewer? Anyone can show me how to do it?

Another question is if it's possible to generate only one report with the data from all dataloggers?

thanks

Post Reply