At the request of a friend susue, I want to publish a new version of susue ~ By the way, I hope you can give me some comments ~ Thank you ~ The running effect is as follows:
A. NET Framework is required
Superficial, with less than 50 lines of code
<% @ Import namespace = "system. Data" %>
<% @ Import namespace = "system. Data. sqlclient" %>
<SCRIPT runat = "server" Language = "C #">
String strconnection; // The string connecting to SQL Server
Sqlcommand objcommand; // SQL statement
Void btnselect_onclick (Object sender, eventargs E)
{
Strconnection = "Server = '" + tbxserver. text + "'; uid ='" + tbxuid. text + "'; Pwd ='" + tbxpwd. text + "'; database ='" + tbxdatabase. text + "'";
Sqlconnection objconnection = new sqlconnection (strconnection );
Objcommand = new sqlcommand (tbxsql. Text, objconnection );
Objconnection. open ();
Dgrdmain. datasource = objcommand. executereader ();
// Dgrdmain is the ID of the DataGrid below
Dgrdmain. databind ();
Objconnection. Close ();
}
</SCRIPT>
<HTML>
<Head>
<Title> B/s SQL Server Query analyzer by susue 2005-2-26 </title>
</Head>
<Body>
<Font color = "# dd0000" size = "5">
SQL Server Query Analyzer of B/S by susue 2005-2-26
<HR>
</Font>
<Form runat = "server">
<Asp: Label text = "Database Server:" id = "lbl1" width = "150" runat = "server"/>
<Asp: Label text = "User name:" id = "lbl2" width = "150" runat = "server"/>
<Asp: Label text = "Password:" id = "lbl3" width = "150" runat = "server"/>
<Asp: Label text = "Database Name:" id = "lbl4" runat = "server"/> <br>
<Asp: textbox text = "server" id = "tbxserver" runat = "server"/>
<Asp: textbox text = "uid" id = "tbxuid" runat = "server"/>
<Asp: textbox text = "PWD" id = "tbxpwd" runat = "server"/>
<Asp: textbox text = "Database" id = "tbxdatabase" runat = "server"/> <br>
<Asp: textbox text = "-- here you can enter an SQL statement, you can only execute one "id =" tbxsql "width =" 633px "rows =" 6 "textmode =" multiline "runat =" server "/> <br>
<Asp: button text = "Row query" onclick = "btnselect_onclick" id = "btnselect" width = "633" runat = "server"/> <br>
<Asp: DataGrid id = "dgrdmain" cellpadding = "1" showheader = "true" borderwidth = "1" runat = "server"/>
</Form>
<HR>
<Font color = "# dd0000" size = "5">
SQL Server Query Analyzer of B/S by susue 2005-2-26
</Font>
</Body>
</Html>
Http://www.chinaaspx.com/comm/dotnetbbs/Showtopic.aspx? Forum_id = 5 & id = 117612 & ppage = 1