protected void SaveAttachements(Int64 noticeDetailID) { try { if (gvAttachments.Rows.Count > 0) { String Sql = string.Empty; if ((Session["FileDetail"].ToString() !="")) { string[] Records = Session["FileDetail"].ToString().Split('#'); for (int i = 0; i < Records.Length; i++) { string[] arrRecords = Records[i].Split(','); cmd = new SqlCommand(); cmd.CommandText = "select File_Name,File_Format,File_Content from Temporary_Attachment Where File_ID='" + arrRecords[1] + "'"; cmd.CommandType = CommandType.Text; cmd.Connection = con; SqlDataReader dr = cmd.ExecuteReader(); while (dr.Read()) { cmd = new SqlCommand(); Sql = "Insert into Notice_Attachment(File_Name,File_Format,File_Content,Notice_Detail_ID) values ('" + dr["File_Name"].ToString() + "','" + dr["File_Format"].ToString() + "',(Select top(1) File_Content from Temporary_Attachment Where File_ID='" + arrRecords[1] + "')," + noticeDetailID + ")"; cmd.CommandText = Sql; cmd.CommandType = CommandType.Text; cmd.Connection = con; cmd.ExecuteNonQuery(); Sql = "Delete from Temporary_Attachment Where File_ID='" + arrRecords[1] + "'"; cmd.CommandText = Sql; cmd.CommandType = CommandType.Text; cmd.Connection = con; cmd.ExecuteNonQuery(); } } } } } catch (Exception ex) { } }
cmd.TimeOut=180;
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)