Mrz 26 2009

MySQL Passwort vergessen

Tag: DatenbankenMichael @ 11:53

MySQL-Server anhalten:

/etc/init.d/mysql stop

In die MySQL-Shell einloggen:

mysqld_safe  --user=root --datadir=/var/lib/mysql --skip-grant-tables & mysql --user=root mysql

Neues Passwort festlegen :

mysql> update user set Password=PASSWORD('Neues Password') WHERE User='root';
mysql> quit;

MySQL neustarten:

/etc/init.d/mysql start

Mrz 12 2009

C# Equivalent für VB’s “Left” Funktion

Tag: .NETMichael @ 13:35
public static string Left(string strText, int intLength)
{
    try
	{
		if (intLength < 0)
			throw new ArgumentOutOfRangeException("Length", intLength, "Length must be > 0");
		else if (intLength == 0 || strText.Length == 0)
			return "";
		else if (strText.Length <= intLength)
			return strText;
		else
			return strText.Substring(0, intLength);
	}
	catch {}
}