http://dl2.csdn.net/down4/20070719/19101125349.dll
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;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
public partial class Default8 : System.Web.UI.Page
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
...{
MVC_M.MODEL a = new MVC_M.MODEL();
protected void Page_Load(object sender, EventArgs e)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
...{
if (!IsPostBack)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
...{
show1();
}
else
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
...{
Response.Write(@"<script>alert('您的操作成功﹗')</script>");
show1();
}
}
protected void Button1_Click(object sender, EventArgs e)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
...{
insert1();
}
protected void Button2_Click(object sender, EventArgs e)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
...{
delete1();
}
protected void Button3_Click(object sender, EventArgs e)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
...{
update1();
}
private void show()
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
...{
a.Connstring = @"Data Source=JOHNSQLEXPRESS;Initial Catalog=test;Persist Security Info=True;User ID=sa";
GridView1.DataSource = a.GetData("select * from Table1");
GridView1.DataBind();
}
private void show1()
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
...{
string[] strParams = null;
object[] objValues = null;
a.Connstring = @"Server=johnsqlexpress;uid=sa;pwd=;database=test;";
GridView1.DataSource = a.GetData("proc_select", strParams, objValues);
GridView1.DataBind();
}
private void insert()
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
...{
a.Connstring = @"Data Source=JOHNSQLEXPRESS;Initial Catalog=test;Persist Security Info=True;User ID=sa";
a.exeSql("insert into Table1(TName) values('" + TextBox2.Text + "')");
show();
}
private void insert1()
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
string[] strParams =...{ "@TName" };
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
object[] objValues =...{ TextBox2.Text };
a.Connstring = @"Server=johnsqlexpress;uid=sa;pwd=;database=test;";
if (a.exeSql("proc_insert", strParams, objValues) > 0)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
...{
show1();
Response.Write(@"<script>alert('您的操作成功﹗')</script>");
}
else
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
...{
Response.Write(@"<script>alert('您的操作失敗﹗')</script>");
}
}
private void delete()
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
...{
a.Connstring = @"Data Source=JOHNSQLEXPRESS;Initial Catalog=test;Persist Security Info=True;User ID=sa";
a.exeSql("delete from Table1 where TID=" + Convert.ToInt32(TextBox1.Text));
show();
}
private void delete1()
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
string[] strParams = ...{ "@TID" };
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
object[] objValues = ...{ TextBox1.Text};
a.Connstring = @"Server=johnsqlexpress;uid=sa;pwd=;database=test;";
if (a.exeSql("proc_delete", strParams, objValues) > 0)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
...{
show1();
Response.Write(@"<script>alert('您的操作成功﹗')</script>");
}
else
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
...{
Response.Write(@"<script>alert('您的操作失敗﹗')</script>");
}
}
private void update()
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
...{
a.Connstring = @"Data Source=JOHNSQLEXPRESS;Initial Catalog=test;Persist Security Info=True;User ID=sa";
a.exeSql("update Table1 set TName='" + TextBox2.Text + "' where TID=" + Convert.ToInt32(TextBox1.Text));
show();
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
private void update1()
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
string[] strParams = ...{ "@TID", "@TName" };
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
object[] objValues = ...{ TextBox1.Text,TextBox2.Text};
a.Connstring = @"Server=johnsqlexpress;uid=sa;pwd=;database=test;";
if (a.exeSql("proc_update", strParams, objValues) > 0)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
...{
show1();
Response.Write(@"<script>alert('您的操作成功﹗')</script>");
}
else
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
...{
Response.Write(@"<script>alert('您的操作失敗﹗')</script>");
}
}
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)