Rumah  >  Artikel  >  pangkalan data  >  MySQLSQL数据库清空代码清空

MySQLSQL数据库清空代码清空

WBOY
WBOYasal
2016-06-07 16:11:261893semak imbas

以下的文章主要介绍的是MySQLSQL数据库清空代码 _php 清空mysql asp的实际操作情况,本文主要讲述的是access或是mssql 2009-10-14 17:34asp 代码的详细解析,希望会给你带来一些帮助在此方面。 复制代码 代码如下: % DimRs,Conn Set Conn = Server .CreateOb

以下的文章主要介绍的是MySQLSQL数据库清空代码 _php 清空mysql asp的实际操作情况,本文主要讲述的是access或是mssql 2009-10-14 17:34asp 代码的详细解析,希望会给你带来一些帮助在此方面。

复制代码 代码如下:

<ol class="dp-xml">
<li class="alt"><span><span class="tag"><span>%   </span></span></span></li>
<li><span>Dim Rs,Conn   </span></li>
<li class="alt">
<span>Set </span><span class="attribute">Conn</span><span>=</span><span class="attribute-value">Server</span><span>.CreateObject("Adodb.Connection")   </span>
</li>
<li>
<span>Conn.Open "</span><span class="attribute">Provider</span><span>=</span><span class="attribute-value">Microsoft</span><span>.Jet.OLEDB.4.0;Data </span><span class="attribute">Source</span><span>="&server.mappath("</span><span class="attribute-value">readlog</span><span>.mdb")   </span>
</li>
<li class="alt">
<span>Set </span><span class="attribute">Rs</span><span>=</span><span class="attribute-value">Conn</span><span>.OpenSchema(20)   </span>
</li>
<li><span>Do While not Rs.Eof   </span></li>
<li class="alt"><span>If Ucase(Rs("TABLE_TYPE"))="TABLE" Then ' </span></li>
</ol>

如果是用户表

<ol class="dp-xml">
<li class="alt"><span><span>Conn.Execute("Drop Table "&Rs("TABLE_NAME")&"")   </span></span></li>
<li><span>End If   </span></li>
<li class="alt"><span>Rs.MoveNext   </span></li>
<li><span>Loop   </span></li>
<li class="alt"><span>Response.Write "成功!"   </span></li>
<li><span>Rs.Close   </span></li>
<li class="alt">
<span>Set </span><span class="attribute">Rs</span><span>=</span><span class="attribute-value">Nothing</span><span>   </span>
</li>
<li><span>Conn.Close   </span></li>
<li class="alt">
<span>Set </span><span class="attribute">Conn</span><span>=</span><span class="attribute-value">Nothing</span><span>   </span>
</li>
<li>
<span>%</span><span class="tag">></span><span> </span>
</li>
</ol>

php清空mysql

MySQLSQL数据库;复制代码 代码如下:

<ol class="dp-xml">
<li class="alt"><span><span class="tag"></span><span class="tag-name">php</span><span>   </span></span></li>
<li>
<span>$</span><span class="attribute">user</span><span> = </span><span class="attribute-value">"readlog.cn"</span><span>;//账号   </span>
</li>
<li class="alt">
<span>$</span><span class="attribute">password</span><span> = </span><span class="attribute-value">"readlog.cn"</span><span>;//密码   </span>
</li>
<li>
<span>$</span><span class="attribute">dbname</span><span> = </span><span class="attribute-value">"readlog"</span><span>;//数据库   </span>
</li>
<li class="alt">
<span>$</span><span class="attribute">link</span><span> = </span><span class="attribute-value">mysql_connect</span><span>("localhost:3306",$user,$password);   </span>
</li>
<li><span>mysql_select_db("$dbname",$link);   </span></li>
<li class="alt">
<span>echo "</span><span class="tag"><span class="tag-name">p</span><span class="tag">></span><span>正在清空数据库...";   </span></span>
</li>
<li>
<span>$</span><span class="attribute">result</span><span>=</span><span class="attribute-value">mysql_query</span><span>("SHOW tables",$link);   </span>
</li>
<li class="alt">
<span>while ($</span><span class="attribute">currow</span><span>=</span><span class="attribute-value">mysql_fetch_array</span><span>($result));   </span>
</li>
<li><span>mysql_query("DROP TABLE IF EXISTS $currow[0]");   </span></li>
<li class="alt"><span>echo "成功!";   </span></li>
<li>
<span class="tag">?></span><span> </span>
</li>
</ol>

asp清空mssql

复制代码 代码如下:
 

<ol class="dp-xml">
<li class="alt"><span><span class="tag"><span>%   </span></span></span></li>
<li><span>Dim Rs,Conn   </span></li>
<li class="alt">
<span>Set </span><span class="attribute">Conn</span><span>=</span><span class="attribute-value">Server</span><span>.CreateObject("Adodb.Connection")   </span>
</li>
<li>
<span>Conn.Open "</span><span class="attribute">Provider</span><span>=</span><span class="attribute-value">Sqloledb</span><span>; User </span><span class="attribute">ID</span><span>=</span><span class="attribute-value">readlog</span><span>.cn; </span><span class="attribute">Password</span><span>=</span><span class="attribute-value">readlog</span><span>.cn; Initial </span><span class="attribute">Catalog</span><span> =</span><span class="attribute-value">readlog</span><span>; Data </span><span class="attribute">Source</span><span>=(local);"   </span>
</li>
<li class="alt">
<span>Set </span><span class="attribute">Rs</span><span>=</span><span class="attribute-value">Conn</span><span>.Execute("Select name from sysobjects Where </span><span class="attribute">xtype</span><span>=</span><span class="attribute-value">char</span><span>(85) order by id")   </span>
</li>
<li><span>Do While Not Rs.Eof   </span></li>
<li class="alt"><span>Conn.Execute("drop table table "&rs(0)&"")   </span></li>
<li><span>Rs.movenext   </span></li>
<li class="alt"><span>loop   </span></li>
<li><span>Response.Write "成功!"   </span></li>
<li class="alt"><span>Rs.Close   </span></li>
<li>
<span>Set </span><span class="attribute">Rs</span><span>=</span><span class="attribute-value">Nothing</span><span>   </span>
</li>
<li class="alt"><span>Conn.Close   </span></li>
<li>
<span>Set </span><span class="attribute">Conn</span><span>=</span><span class="attribute-value">Nothing</span><span>   </span>
</li>
<li class="alt">
<span>%</span><span class="tag">></span><span> </span>
</li>
</ol>

以上的相关内容就是对MySQLSQL数据库清空代码的介绍,望你能有所收获。


Kenyataan:
Kandungan artikel ini disumbangkan secara sukarela oleh netizen, dan hak cipta adalah milik pengarang asal. Laman web ini tidak memikul tanggungjawab undang-undang yang sepadan. Jika anda menemui sebarang kandungan yang disyaki plagiarisme atau pelanggaran, sila hubungi admin@php.cn