更新不到数据库,请教
<%@ 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>