how to export multiple query?
Posted: Wed 18 Jan 2012 23:34
Hi All,
I am writing an application in asp.net (C#) with using dotConnect for MySQL. In my application, I allow user query multiple command such as(
> SELECT * FROM myTable1;
> SELECT * FROM myTable2;
> UPDATE myTable3 SEET COLUMNA = 'hi' WHERE COLUMNID = 1;
In order to allow execute in one command, I will use MySQLDataTable class.
My codes look like this:
string strQuery = "SELECT * FROM myTable1;\nSELECT * FROM myTable2;\nUPDATE myTable3 SEET COLUMNA = 'hi' WHERE COLUMNID = 1;
.......
MySqlCommand myComm = new MySqlCommand();
MySqlDataTable myDataTable = new MySqlDataTable();
myDataTable.Connection = OpenMySQLConnection();
myComm.CommandText = strQuery;
(myDataTable.SelectCommand = myComm;
myDataTable.Active = true;
myDataTable.FetchAll = true;
foreach (DataRow myRow in myDataTable.Rows)
{
foreach (DataColumn myCol in myDataTable.Columns)
{
Console.Write("\"" + myRow[myCol] + "\"");
}
Console.WriteLine();
}
........
So, with using dotConnect for MySQL. My question is:
1) Is it possible to have multiple query
1) How can I export multiple query
2) How can I write to different output (like: each query in one output file)
Thanks a lot for your help.
I am writing an application in asp.net (C#) with using dotConnect for MySQL. In my application, I allow user query multiple command such as(
> SELECT * FROM myTable1;
> SELECT * FROM myTable2;
> UPDATE myTable3 SEET COLUMNA = 'hi' WHERE COLUMNID = 1;
In order to allow execute in one command, I will use MySQLDataTable class.
My codes look like this:
string strQuery = "SELECT * FROM myTable1;\nSELECT * FROM myTable2;\nUPDATE myTable3 SEET COLUMNA = 'hi' WHERE COLUMNID = 1;
.......
MySqlCommand myComm = new MySqlCommand();
MySqlDataTable myDataTable = new MySqlDataTable();
myDataTable.Connection = OpenMySQLConnection();
myComm.CommandText = strQuery;
(myDataTable.SelectCommand = myComm;
myDataTable.Active = true;
myDataTable.FetchAll = true;
foreach (DataRow myRow in myDataTable.Rows)
{
foreach (DataColumn myCol in myDataTable.Columns)
{
Console.Write("\"" + myRow[myCol] + "\"");
}
Console.WriteLine();
}
........
So, with using dotConnect for MySQL. My question is:
1) Is it possible to have multiple query
1) How can I export multiple query
2) How can I write to different output (like: each query in one output file)
Thanks a lot for your help.