也是关于存储过程的
我在sql中创建了一个存储过程:
CREATE PROCEDURE n_addTopic @a_strTitle char(40),@a_strAuthor char(40),@a_strContent char(40)AS
insert into guestbook (Author,Title,Content) values(@a_strTitle,@a_strAuthor,@a_strContent)
GO
程序代码:
SqlConnection conn=new SqlConnection(sql);
SqlCommand myCommand=new SqlCommand("n_addTopic",conn);
myCommand.CommandType = CommandType.StoredProcedure ;
myCommand.Parameters.Add(new SqlParameter("@a_strTitle" , SqlDbType.VarChar,100)) ;
myCommand.Parameters["@a_strTitle"].Value = n_Topic.Title ;
myCommand.Parameters.Add(new SqlParameter("@a_strAuthor" , SqlDbType.VarChar,50)) ;
myCommand.Parameters["@a_strAuthor"].Value = n_Topic.Author ;
myCommand.Parameters.Add(new SqlParameter("@a_strContent" , SqlDbType.VarChar,2000)) ;
myCommand.Parameters["@a_strContent"].Value = n_Topic.Content ;
myCommand.ExecuteNonQuery()
执行后,怎么数据库有两条相同的记录?