Display database result vertically

By default, database will showing the result according to the select entry in tables,

mysql> select * from wp_terms WHERE term_id='1';
+---------+----------+----------+------------+
| term_id | name     | slug     | term_group |
+---------+----------+----------+------------+
|       1 | Blogging | blogging |          0 |
+---------+----------+----------+------------+
1 row in set (0.00 sec)

Somehow, you could make them display in vertically.

mysql> select * from wp_terms WHERE term_id='1'\G;
*************************** 1. row ***************************
term_id: 1
name: Blogging
slug: blogging
term_group: 0
1 row in set (0.00 sec)

This could be done by just use the “\G” (without quotation) from the query.

Connect ASP.Net script with MySQL

It is very easy if you have ASP.Net script and want to connect to MySQL databases.

Today, Mick Genie will share how to connect your MySQL database with your ASP.Net script.

Sample Code:
==========
<%@ Page Language=”VB” debug=”true” %>
<%@ Import Namespace = “System.Data” %>
<%@ Import Namespace = “MySql.Data.MySqlClient” %>
<script language=”VB” runat=”server”>

Sub Page_Load(sender As Object, e As EventArgs)

Dim myConnection  As MySqlConnection
Dim myDataAdapter As MySqlDataAdapter
Dim myDataSet     As DataSet

Dim strSQL        As String
Dim iRecordCount  As Integer

myConnection = New MySqlConnection(“server=localhost; user id=mickgenie; password=password; database=database;”)

strSQL = “SELECT * FROM mytable;”

myDataAdapter = New MySqlDataAdapter(strSQL, myConnection)
myDataSet = New Dataset()
myDataAdapter.Fill(myDataSet, “mytable”)

MySQLDataGrid.DataSource = myDataSet
MySQLDataGrid.DataBind()

End Sub

</script>

<html>
<head>
<title>Simple MySQL Database Query</title>
</head>
<body>

<form runat=”server”>

<asp:DataGrid id=”MySQLDataGrid” runat=”server” />

</form>

</body>
</html>
==========

From the above code, you may change the setting from myConnection and you shall be able to connect without any problem.