| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 654 人关注过本帖
标题:更新不到数据库,请教
只看楼主 加入收藏
wang85
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2008-5-1
收藏
 问题点数:0 回复次数:0 
更新不到数据库,请教
<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@ import Namespace="System.Data" %>
<%@ import Namespace="System.Data.SqlClient" %>
<%@ import Namespace="System.Data.OleDb" %>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.
<html xmlns="http://www. >
<script Language="C#" runat="server">
    void lianjie(object serder, EventArgs e)
    {


        SqlConnection pp = new SqlConnection("Data Source=localhost;uid=sa;pwd=2050696;initial catalog=wang85");
        DataSet ds = new DataSet();
        pp.Open();
        SqlDataAdapter sqld = new SqlDataAdapter("select * from student", pp);
        sqld.Fill(ds, "tabstudent");
        DataRow drow;
        drow = ds.Tables["tabstudent"].NewRow();
        //drow[0] = TextBox1.Text; drow[1] = DropDownList1.Text; drow[2] = TextBox4.Text; drow[3] = TextBox5.Text; drow[4] = TextBox6.Text;
        drow[0] = "12"; drow[1] = "34"; drow[2] = "56"; drow[3] = "78"; drow[4] = "90";
        ds.Tables["tabstudent"].Rows.Add(drow);

        ds.Tables["tabstudent"].AcceptChanges();
        sqld.Update(ds, "tabstudent");
        dg.DataSource = ds.Tables["tabstudent"].DefaultView;
        dg.DataBind();
        pp.Close();
        pp = null;
      
   
   
   
   
    }
   
   
   
   
   
   
   
   
   
   
   
   
    </script>
<head id="Head1" runat="server">
    <title>无标题页</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <br />  
        <asp:datagrid id="dg" runat="server" ></asp:datagrid ><br />
        <asp:Label ID="Label1" runat="server" Height="33px" Text="      注册" Width="215px"></asp:Label><br />
        <br />
        <asp:Label ID="Label2" runat="server" Height="23px" Text="姓名" Width="78px"></asp:Label>
        <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox><br />
        <br />
        <asp:Label ID="Label3" runat="server" Height="23px" Text="性别" Width="78px"></asp:Label>
        <asp:DropDownList ID="DropDownList1" runat="server" Height="22px" Width="154px">
            <asp:ListItem>男</asp:ListItem>
            <asp:ListItem>女</asp:ListItem>
        </asp:DropDownList><br />
        <br />
        <asp:Label ID="Label4" runat="server" Height="23px" Text="密码" Width="78px"></asp:Label>
        <asp:TextBox ID="TextBox3" runat="server" Height="23px" Width="149px"></asp:TextBox><br />
        <br />
        <asp:Label ID="Label5" runat="server" Height="23px" Text="确认密码" Width="78px"></asp:Label>
        <asp:TextBox ID="TextBox4" runat="server"></asp:TextBox><br />
        <br />
        <asp:Label ID="Label6" runat="server" Height="23px" Text="邮箱" Width="78px"></asp:Label>
        <asp:TextBox ID="TextBox5" runat="server"></asp:TextBox><br />
        <br />
        <asp:Label ID="Label7" runat="server" Height="23px" Text="qq" Width="78px"></asp:Label>
        <asp:TextBox ID="TextBox6" runat="server"></asp:TextBox><br />
        <br />
        <asp:Label ID="Label8" runat="server" Height="23px" Text="验证码 " Width="78px"></asp:Label>
        <asp:TextBox ID="TextBox7" runat="server"></asp:TextBox>
        <asp:Label ID="Label9" runat="server" Height="23px" Width="78px"></asp:Label><br />
        <br />
        <br />
        <br />
        <br />
        <asp:Button ID="Button2" runat="server" onclick="lianjie" Text="提交" />
        <asp:Button ID="Button1" runat="server" Text="重写" /><br />
        <br />
        <br />
        <br />
   
    </div>
    </form>
</body>
</html>

注册.rar (14.46 KB) 界面

搜索更多相关主题的帖子: 数据库 import DTD Data 
2008-05-01 21:33
快速回复:更新不到数据库,请教
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.041191 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved