cori (纯洁的女流氓) :绝对没问题,你也不用那么激动啊,喊救命,我以为发生什么事故了
呵呵
呵呵
解决方案 »
- C# winfrom问题
- 有没有高手指点一下,.net中那些命名空间应该认真看一下
- javascript获取checkboxlist值的问题
- (送分)“日期类型”格式化成为“数字类型”!!
- 把一个vbs函数,改成c#
- 求助:如何配置和读取web.config
- 根据数据表中的某个字段的特定值设定该行的底色,或者显示特定图片
- 局域网中两台win2003服务器不能互相访问是为什么
- onclick/oncommand
- 在ASP.NET中在服务器端用什么方法能实现比如JAVASCRIPT里的confirm窗口呢?
- 在VS.net2003中创建新WEB项目时遇到的问题
- ASP.NET时尚编程百例中的一个例子中的几句话弄不懂是为什么?高手请进!!!
<%@ Import Namespace="System.Data.SqlClient" %><html>
<script language="C#" runat="server"> SqlConnection myConnection; protected void Page_Load(Object sender, EventArgs e)
{
myConnection =new SqlConnection("data source=你的ip;user id=sa;password=;initial catalog=pubs"); if (!IsPostBack)
BindGrid("au_id");
} protected void MyDataGrid_Sort(Object sender, DataGridSortCommandEventArgs e)
{
BindGrid(e.SortExpression);
} public void BindGrid(String sortfield)
{
SqlDataAdapter myCommand = new SqlDataAdapter("select * from Authors", myConnection); DataSet ds = new DataSet();
myCommand.Fill(ds, "Authors"); DataView Source = ds.Tables["Authors"].DefaultView;
Source.Sort = sortfield; MyDataGrid.DataSource=Source;
MyDataGrid.DataBind();
}</script><body> <h3><font face="Verdana">Sorting Data in a DataGrid Control</font></h3> <form runat="server"> <ASP:DataGrid id="MyDataGrid" runat="server" OnSortCommand="MyDataGrid_Sort"
Width="700"
BackColor="#ccccff"
BorderColor="black"
ShowFooter="false"
CellPadding=3
CellSpacing="0"
Font-Name="Verdana"
Font-Size="8pt"
HeaderStyle-BackColor="#aaaadd"
AllowSorting="true"
/> </form></body>
</html>
在sql server上用
在"你的ip"出改为你自己的ip 要是本机的sql server可以写localhost
user 为用户名
password是密码这样就可以运行了