asp.net a SQL replacement program on a Web page
<%@ Page language= "C #" autoeventwireup= "true" codefile= "Repair_data.aspx.cs" inherits= "Admin_repair_data" Validaterequest= "false"%>
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<title> Untitled Page </title>
<body>
<form id= "Form1" runat= "Server" >
<div>
<asp:textbox id= "TextBox1" runat= "Server" width= "597px" ></asp:TextBox>
<asp:button id= "Button1" runat= "Server" onclick= "Button1_Click" text= "Repair"/><br/>
<br/>
Progress: <br/>
<asp:literal id= "Literal1" runat= "Server" ></asp:Literal></div>
</form>
</body>
CS file
Using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.IO;
using System.Text.RegularExpressions;
public partial class Admin_Repair_data:System.Web.UI.Page
{
my_basic my_b = new My_basic ();
my_conn my_c = new My_conn ();
protected void Page_Load (object sender, EventArgs e)
{
& nbsp; if (! Page.IsPostBack)
{
}
}
protected void Button1_Click (object sender, EventArgs e)
{
DataTable dt = my_c.gettable ("Select name,id,crdate,refdate from sysobjects WHERE xtype = ' U ' and objectproperty (ID, ' IsM sshipped ') = 0 ");
for (int i = 0; i < dt. Rows.Count; i++)
{
DataTable dt1 = my_c.gettable ("Select Name,xtype from syscolumns WHERE id=object_id ('" + dt.) rows[i]["Name"]. ToString () + "')");
string T1 = "";
for (int j = 0; J < Dt1. Rows.Count; J + +)
{
if (DT1. rows[j]["Xtype"]. ToString () = = "231" | | Dt1. rows[j]["Xtype"]. ToString () = = "99")
{
if (T1 = "")
{
T1 = dt1. rows[j]["Name"]. ToString ();
}
Else
{
T1 = t1 + "|" + DT1. rows[j]["Name"]. ToString ();
}
}
}
if (T1!= "")
{
DataTable DT2 = my_c.gettable ("SELECT ID," + t1.) Replace ("|", ",") + "from" + dt. rows[i]["Name"]. ToString () + "");
for (int h = 0; h < DT2. Rows.Count; h++)
{
String sql = "Update" + dt. rows[i]["Name"]. ToString () + "set";
string[] aa = t1. Split (' | ');
for (int l = 0; l < AA. Length; l++)
{
if (L = = 0)
{
sql = SQL + "" + aa[l]. ToString () + "= '" + DT2. ROWS[H][AA[L]. ToString ()]. ToString (). Replace (My_b.c_string (this. TextBox1.Text), "") + "'";
}
Else
{
sql = SQL + "," + aa[l]. ToString () + "= '" + DT2. ROWS[H][AA[L]. ToString ()]. ToString (). Replace (My_b.c_string (this. TextBox1.Text), "") + "'";
}
}
sql = SQL + "where id=" + DT2. rows[h]["id"]. ToString ();
Response.Write (SQL);
Response.End ();
My_c.genxin (SQL);
}
}
}
Literal1.text = "complete";
}
}