初学c#向sql 添加数据 怎么都不成功 望高人指点
<%@ Import Namespace= "System.Data " %>
<%@ Import Namespace= "System.Data.SqlClient " %>
<html>
<head id= "Head1 " runat= "server ">
<title> 无标题页 </title>
</head>
<script language= "c# " runat= "server ">
SqlConnection objConnection = new SqlConnection( "database=gewei;server=(local);Connect Timeout=30;User=sa;pwd=123456 ");
public void Page_Load(Object sender, EventArgs e)
{
if (!IsPostBack)
{
binggrid();
}
}
void binggrid()
{
DataSet ds = new DataSet();
string strcomm = "SELECT *FROM score ";
string strConnection = "database=gewei;server=(local);Connect Timeout=30;User=sa;pwd=123456 ";
using (SqlConnection objConnection = new SqlConnection(strConnection))
{
SqlDataAdapter adap = new SqlDataAdapter(strcomm, objConnection);
adap.Fill(ds, "score ");
}
dg.DataSource = ds.Tables[ "score "].DefaultView;
dg.DataBind();
}
void addscore(object sender, EventArgs e)
{
DataSet ds;
string insercmd = "insert into score(名称,站址,确认,类别,说明) values( ' ";
insercmd += s_name.Value + " ', ' ";
insercmd += s_url.Value + " ', ";
insercmd += s_queren.Value + ", ' ";
insercmd += s_leibie.Value + " ', ' ";
insercmd += s_shuoming.Value + " ' ";