I am creating an application to store Excel files into a database using the filestream data type provided by SQL Server 2008, and now I'm stuck searching the internet for the best practice way to insert it using a stored procedure from C#.
So far, I've created the database structure and the classes, what I need to do now is to actually use the stored procedure and I'm stuck, here's the snippet of code
OpenFileDialog ofd = new OpenFileDialog();
ofd.ShowDialog();
if (ofd.CheckFileExists)
{
    ....            
}
using (SqlConnection conn = new SqlConnection(Murel.Util.DBUtil.CONSTRING))
{
    try
    {
        conn.Open();
        using (SqlCommand cmd = new SqlCommand("items_insert", conn))
        {
           cmd.CommandType = CommandType.StoredProcedure;
           cmd.Parameters.Add(new SqlParameter("@name", "test"));
           cmd.Parameters.Add(new SqlParameter("@template", HELP));
           Guid id = (Guid)cmd.ExecuteScalar();
           return true;
        }
     }
     catch (Exception ex)
     {
        throw ex;
     }
     finally
     {
         conn.Close();
     }
  }
The data table consist of an id which is an unique identifier, name and template which is varbinary(max), I already have anything else set up, I just need to know what to put in
cmd.Parameters.Add(new SqlParameter("@template", HELP));
thx,
darius