convert php code to c# trying make program convert myisam db to innodb -
i'm trying make app convert myisam innodb
if found php script code
<?php // connect database here first // // actual code starts here $sql = "select table_name information_schema.tables table_schema = 'your_database_name' , engine = 'myisam'"; $rs = mysql_query($sql); while($row = mysql_fetch_array($rs)) { $tbl = $row[0]; $sql = "alter table `$tbl` engine=innodb"; mysql_query($sql); } ?>
then try make iin c#
public static void updatedb() { using (var cnn = new mysqlconnection(con)) { cnn.open(); using (var cmd = new mysqlcommand("select table_name information_schema.tables table_schema = '" + db + "' , engine = 'myisam'", cnn)) { using (var reader = cmd.executereader()) { while (reader.read()) { } } } } }
and can't understand codes mean
$tbl = $row[0]; $sql = "alter table `$tbl` engine=innodb"; mysql_query($sql);
i tried , failed can 1 me
thanks
Comments
Post a Comment