protected void btnInsert_Click(object sender, EventArgs e) { cmd.CommandText = "sp_Admininsert"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@Title", SqlDbType.NVarChar); cmd.Parameters.Add("@Author", SqlDbType.NVarChar); cmd.Parameters.Add("@Address", SqlDbType.NVarChar); cmd.Parameters.Add("@Url", SqlDbType.NVarChar); cmd.Parameters.Add("@Reference", SqlDbType.NVarChar); cmd.Parameters.Add("@Abstract", SqlDbType.NVarChar); cmd.Parameters.Add("@Categories", SqlDbType.NVarChar); cmd.Parameters.Add("@Year", SqlDbType.NVarChar); cmd.Parameters["@Title"].Value = txtTitle.Text.Trim(); cmd.Parameters["@Author"].Value = TextAuthor.Text.Trim(); cmd.Parameters["@Address"].Value = TextAddress.Text.Trim(); cmd.Parameters["@Reference"].Value = TextReference.Text.Trim(); cmd.Parameters["@Abstract"].Value = TextAbstract.Text.Trim(); cmd.Parameters["@Categories"].Value = TextCategories.Text.Trim(); cmd.Parameters["@Year"].Value = TextYear.Text.Trim(); cmd.Parameters["@Url"].Value = cmd.Parameters.Add("@retid", SqlDbType.Int); cmd.Parameters["@retid"].Direction = ParameterDirection.ReturnValue; con.Open(); cmd.ExecuteNonQuery(); string id = cmd.Parameters["@retid"].Value.ToString(); cmd.Parameters.Clear(); con.Close(); fupPic.SaveAs(MapPath("~/PDF/" + TextYear.Text.Trim() + "/" + id + Path.GetExtension(fupPic.FileName))); } }
Server.MapPath
Server.MapPath("~/PDF/"+yourfilenamefromdb);
"PDF/filename"
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)