Utilizzo questa funzione per leggere dal database:
codice:
public static string RunRead(string TheQuery)
{
MySQL_rs.Open(TheQuery, MySQL_Conn, CursorTypeEnum.adOpenKeyset, LockTypeEnum.adLockOptimistic, -1);
string tmp = null;
if (MySQL_rs.EOF == false)
{
tmp = MySQL_rs.GetString(StringFormatEnum.adClipString, -1, null, null, null);
tmp = tmp.Substring(0, tmp.Length - 1);
}
MySQL_rs.Close();
return tmp;
}
Con:
codice:
public static string MySQL_IP = "localhost";
public static int MySQL_Port = 3306;
public static string MySQL_DB = "debboproject";
public static string MySQL_Username = "root";
public static string MySQL_Password = "";
static ADODB.Connection MySQL_Conn = new ADODB.Connection();
static ADODB.Recordset MySQL_rs = new ADODB.Recordset();