Hi,
I have not been able to find this addressed anywhere so that is why I am posting a new thread.
In the database table this field is defined to be nchar(15). The parameter @AddedByIP in the tbh_Articles_InsertComment stored procedure is consequently also defined to be nchar(15). In the downloaded code this is the implementation of the InsertComment method in the SqlArticlesProvider class:
Code:
public override int InsertComment(CommentDetails comment)
{
using (SqlConnection cn = new SqlConnection(this.ConnectionString))
{
SqlCommand cmd = new SqlCommand("tbh_Articles_InsertComment", cn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@AddedDate", SqlDbType.DateTime).Value = comment.AddedDate;
cmd.Parameters.Add("@AddedBy", SqlDbType.NVarChar).Value = comment.AddedBy;
cmd.Parameters.Add("@AddedByEmail", SqlDbType.NVarChar).Value = comment.AddedByEmail;
cmd.Parameters.Add("@AddedByIP", SqlDbType.NVarChar).Value = comment.AddedByIP;
cmd.Parameters.Add("@ArticleID", SqlDbType.Int).Value = comment.ArticleID;
cmd.Parameters.Add("@Body", SqlDbType.NVarChar).Value = comment.Body;
cmd.Parameters.Add("@CommentID", SqlDbType.Int).Direction = ParameterDirection.Output;
cn.Open();
int ret = ExecuteNonQuery(cmd);
return (int)cmd.Parameters["@CommentID"].Value;
}
}
Note how in the code the parameter @AddedByIP is defined to be nvarchar. I assume that the site is working fine like that, so I am assuming that there will be a conversion going on in SQL Server 2005. Wouldn't this conversion reduce performance?
Thanks for any clarification on this matter.