首先,你先查询一下输入的用户是否存在
string sql ="select count(*) from user where name='"+this.textbox1.text+"'";
sqlconnection con=new sqlconnection("此处省略");
sqlcommand cmd=new sqlcommand(sql,con);
int result=cmd.ExecuteNonQuery();
if(result>1)
{
response.write("此用户存在");
textbox1.text="";
}
else
{
string sql2="insert into user value(各列值)";
........
//此处编写添加用户代码;
}
可能有误,但思路是应该是这样的;