/// <summary>GridViewKnowledgeBaseInsert</summary> public void GridViewKnowledgeBaseInsert ( Object sender, EventArgs e ) { int contactId; int sequenceOrderId; DateTime dated; string commentary; string exceptionMessage = null; string keyword; string uri; string value; FileUpload fileUploadSource = null; try { value = ((System.Web.UI.WebControls.TextBox)GridViewKnowledgeBase.FooterRow.FindControl("TextBoxGridViewKnowledgeBaseFooterTemplateSequenceOrderId")).Text; if (Int32.TryParse(value, out sequenceOrderId)) { SqlDataSourceKnowledgeBase.InsertParameters["sequenceOrderId"].DefaultValue = value; } value = ((System.Web.UI.WebControls.TextBox)GridViewKnowledgeBase.FooterRow.FindControl("TextBoxGridViewKnowledgeBaseFooterTemplateDated")).Text; if (DateTime.TryParse(value, out dated)) { SqlDataSourceKnowledgeBase.InsertParameters["dated"].DefaultValue = value; } commentary = ((System.Web.UI.WebControls.TextBox)GridViewKnowledgeBase.FooterRow.FindControl("TextBoxGridViewKnowledgeBaseFooterTemplateCommentary")).Text; SqlDataSourceKnowledgeBase.InsertParameters["Commentary"].DefaultValue = commentary; keyword = ((System.Web.UI.WebControls.TextBox)GridViewKnowledgeBase.FooterRow.FindControl("TextBoxGridViewKnowledgeBaseFooterTemplateKeyword")).Text; SqlDataSourceKnowledgeBase.InsertParameters["Keyword"].DefaultValue = keyword; uri = ((System.Web.UI.WebControls.TextBox)GridViewKnowledgeBase.FooterRow.FindControl("TextBoxGridViewKnowledgeBaseFooterTemplateURI")).Text; SqlDataSourceKnowledgeBase.InsertParameters["URI"].DefaultValue = uri; fileUploadSource = ((System.Web.UI.WebControls.FileUpload)GridViewKnowledgeBase.FooterRow.FindControl("FileUploadGridViewKnowledgeBaseFooterTemplateSource")); if (fileUploadSource != null && fileUploadSource.HasFile) { SqlDataSourceKnowledgeBase.InsertParameters["source"].DefaultValue = fileUploadSource.PostedFile.FileName; } value = ((System.Web.UI.WebControls.TextBox)GridViewKnowledgeBase.FooterRow.FindControl("TextBoxGridViewKnowledgeBaseFooterTemplateContactId")).Text; if (Int32.TryParse(value, out contactId)) { SqlDataSourceKnowledgeBase.InsertParameters["contactId"].DefaultValue = value; } SqlDataSourceKnowledgeBase.Insert(); GridViewKnowledgeBase.DataBind(); } catch (System.Exception exception) { exceptionMessage = "System.Exception: " + exception.Message; } if (exceptionMessage != null) { Feedback = exceptionMessage; return; } }
/// <summary>GridViewTheWordInsert</summary> public void GridViewTheWordInsert ( Object sender, EventArgs e ) { int contactId; int sequenceOrderId; DateTime dated; string commentary; string exceptionMessage = null; string filename; string keyword; string scriptureReference; string title; string value; try { value = ((System.Web.UI.WebControls.TextBox)GridViewTheWord.FooterRow.FindControl("TextBoxGridViewTheWordFooterTemplateSequenceOrderId")).Text; if (Int32.TryParse(value, out sequenceOrderId)) { SqlDataSourceTheWord.InsertParameters["sequenceOrderId"].DefaultValue = value; } value = ((System.Web.UI.WebControls.TextBox)GridViewTheWord.FooterRow.FindControl("TextBoxGridViewTheWordFooterTemplateDated")).Text; if (DateTime.TryParse(value, out dated)) { SqlDataSourceTheWord.InsertParameters["dated"].DefaultValue = value; } filename = ((System.Web.UI.WebControls.TextBox)GridViewTheWord.FooterRow.FindControl("TextBoxGridViewTheWordFooterTemplateFilename")).Text; SqlDataSourceTheWord.InsertParameters["Filename"].DefaultValue = filename; value = ((System.Web.UI.WebControls.TextBox)GridViewTheWord.FooterRow.FindControl("TextBoxGridViewTheWordFooterTemplateContactId")).Text; if (Int32.TryParse(value, out contactId)) { SqlDataSourceTheWord.InsertParameters["contactId"].DefaultValue = value; } title = ((System.Web.UI.WebControls.TextBox)GridViewTheWord.FooterRow.FindControl("TextBoxGridViewTheWordFooterTemplateTitle")).Text; SqlDataSourceTheWord.InsertParameters["title"].DefaultValue = title; commentary = ((System.Web.UI.WebControls.TextBox)GridViewTheWord.FooterRow.FindControl("TextBoxGridViewTheWordFooterTemplateCommentary")).Text; SqlDataSourceTheWord.InsertParameters["Commentary"].DefaultValue = commentary; keyword = ((System.Web.UI.WebControls.TextBox)GridViewTheWord.FooterRow.FindControl("TextBoxGridViewTheWordFooterTemplateKeyword")).Text; SqlDataSourceTheWord.InsertParameters["keyword"].DefaultValue = keyword; scriptureReference = ((System.Web.UI.WebControls.TextBox)GridViewTheWord.FooterRow.FindControl("TextBoxGridViewTheWordFooterTemplatescriptureReference")).Text; SqlDataSourceTheWord.InsertParameters["scriptureReference"].DefaultValue = scriptureReference; SqlDataSourceTheWord.Insert(); GridViewTheWord.DataBind(); } catch (System.Exception exception) { exceptionMessage = "System.Exception: " + exception.Message; } if (exceptionMessage != null) { Feedback = exceptionMessage; return; } }
}//public void DetailsViewURI_ItemUpdated /// <summary>GridViewURI_RowCommand</summary> public void GridViewURI_RowCommand ( Object sender, GridViewCommandEventArgs gridViewCommandEventArgs ) { int sequenceOrderId = -1; DateTime dated; string exceptionMessage = null; string commentary = null; string keyword = null; string title = null; string uri = null; try { switch ( gridViewCommandEventArgs.CommandName ) { case "ButtonGridViewURIFooterTemplateAdd": DateTime.TryParse( ( ( System.Web.UI.WebControls.TextBox ) GridViewURI.FooterRow.FindControl("TextBoxGridViewURIFooterTemplateDated")).Text, out dated ); Int32.TryParse( ( ( System.Web.UI.WebControls.TextBox ) GridViewURI.FooterRow.FindControl("TextBoxGridViewURIFooterTemplateSequenceOrderId")).Text, out sequenceOrderId ); commentary = ( ( System.Web.UI.WebControls.TextBox ) GridViewURI.FooterRow.FindControl("TextBoxGridViewURIFooterTemplateCommentary")).Text; keyword = ( ( System.Web.UI.WebControls.TextBox ) GridViewURI.FooterRow.FindControl("TextBoxGridViewURIFooterTemplateKeyword")).Text; title = ( ( System.Web.UI.WebControls.TextBox ) GridViewURI.FooterRow.FindControl("TextBoxGridViewURIFooterTemplateTitle")).Text; uri = ( ( System.Web.UI.WebControls.TextBox ) GridViewURI.FooterRow.FindControl("TextBoxGridViewURIFooterTemplateURI")).Text; if ( sequenceOrderId > 0 ) { SqlDataSourceURIGridView.InsertParameters["sequenceOrderId"].DefaultValue = System.Convert.ToString( sequenceOrderId ); } if ( dated != DateTime.MinValue ) { SqlDataSourceURIGridView.InsertParameters["dated"].DefaultValue = System.Convert.ToString( dated ); } SqlDataSourceURIGridView.InsertParameters["commentary"].DefaultValue = commentary; SqlDataSourceURIGridView.InsertParameters["keyword"].DefaultValue = keyword; SqlDataSourceURIGridView.InsertParameters["title"].DefaultValue = title; SqlDataSourceURIGridView.InsertParameters["uri"].DefaultValue = uri; SqlDataSourceURIGridView.Insert(); break; }//switch ( gridViewCommandEventArgs.CommandName ) }//try catch ( System.Exception exception ) { exceptionMessage = "System.Exception: " + exception.Message; }//catch ( System.Exception exception ) if ( exceptionMessage != null ) { Feedback = exceptionMessage; return; }//if ( exceptionMessage != null ) GridViewURI.DataBind(); }//public void GridViewURI_RowCommand()
protected void Button1_Click(object sender, EventArgs e) { string connstring = "Server=tcp:evansvilledayschoolserver.database.windows.net,1433;Database=EvansvilleDaySchoolDatabase;User ID=Usiwallabies@evansvilledayschoolserver;Password=Quokka12;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;"; string selstring = "SELECT * FROM SUBSCRIPTION JOIN USERS ON USERS.USER_ID = SUBSCRIPTION.USER_ID JOIN LIST ON SUBSCRIPTION.LIST_ID = LIST.LIST_ID"; string phone = Label1.Text + Label4.Text + Label5.Text; string fname = Label2.Text; string lname = Label3.Text; string lists = Label6.Text; SqlDataSource db = new SqlDataSource(connstring, selstring); DataView dv = (DataView)db.Select(DataSourceSelectArguments.Empty); string FirstName = (string)dv.Table.Rows[0][4]; string LastName = (string)dv.Table.Rows[0][5]; string Phone = (string)dv.Table.Rows[0][6]; int userid = (int)dv.Table.Rows[0][0]; string updatestring = String.Format("UPDATE USERS SET USER_FNAME={0}, USER_LNAME={1}, USER_PHONE={2} WHERE USER_ID={3};", fname, lname, phone, userid); db.UpdateCommand = updatestring; //db.InsertCommand = insertstring; if (FirstName == Label2.Text && LastName == Label3.Text) { string firstUpdateString = String.Format("UPDATE USERS SET USER_FNAME={0}, USER_LNAME={1}, USER_PHONE={2} WHERE USER_ID={3};", fname, lname, phone, userid); db.UpdateCommand = updatestring; db.Update(); } else { string insertstring = String.Format("INSERT INTO USERS VALUES {0},{1},{2}", fname, lname, phone); db.Insert(); insertstring = String.Format("INSERT INTO SUBSCRIPTION VALUES {0}", lists); db.InsertCommand = insertstring; db.Insert(); } Response.Redirect("TextAlertRegistration.aspx"); }
/// <summary>GridViewEventInsert</summary> public void GridViewEventInsert ( Object sender, EventArgs e ) { int contactId; int sequenceOrderId; DateTime dated; string commentary; string exceptionMessage = null; string value; try { value = ((System.Web.UI.WebControls.TextBox)GridViewEvent.FooterRow.FindControl("TextBoxGridViewEventFooterTemplateSequenceOrderId")).Text; if (Int32.TryParse(value, out sequenceOrderId)) { SqlDataSourceEvent.InsertParameters["sequenceOrderId"].DefaultValue = value; } value = ((System.Web.UI.WebControls.TextBox)GridViewEvent.FooterRow.FindControl("TextBoxGridViewEventFooterTemplateDated")).Text; if (DateTime.TryParse(value, out dated)) { SqlDataSourceEvent.InsertParameters["dated"].DefaultValue = value; } commentary = ((System.Web.UI.WebControls.TextBox)GridViewEvent.FooterRow.FindControl("TextBoxGridViewEventFooterTemplateCommentary")).Text; SqlDataSourceEvent.InsertParameters["Commentary"].DefaultValue = commentary; value = ((System.Web.UI.WebControls.TextBox)GridViewEvent.FooterRow.FindControl("TextBoxGridViewEventFooterTemplateContactId")).Text; if (Int32.TryParse(value, out contactId)) { SqlDataSourceEvent.InsertParameters["contactId"].DefaultValue = value; } SqlDataSourceEvent.Insert(); GridViewEvent.DataBind(); } catch (System.Exception exception) { exceptionMessage = "System.Exception: " + exception.Message; } if (exceptionMessage != null) { Feedback = exceptionMessage; return; } }
/// <summary>GridViewItsCalledTheSetupScreenOfScreenOneInsert()</summary> public void GridViewItsCalledTheSetupScreenOfScreenOneInsert ( Object sender, EventArgs e ) { int sequenceOrderId; DateTime dated; string screenOne; string exceptionMessage = null; string value; try { value = ((System.Web.UI.WebControls.TextBox)GridViewItsCalledTheSetupScreenOfScreenOne.FooterRow.FindControl("TextBoxGridViewItsCalledTheSetupScreenOfScreenOneFooterTemplateSequenceOrderId")).Text; if (Int32.TryParse(value, out sequenceOrderId)) { SqlDataSourceItsCalledTheSetupScreenOfScreenOne.InsertParameters["sequenceOrderId"].DefaultValue = value; } value = ((System.Web.UI.WebControls.TextBox)GridViewItsCalledTheSetupScreenOfScreenOne.FooterRow.FindControl("TextBoxGridViewItsCalledTheSetupScreenOfScreenOneFooterTemplateDated")).Text; if (DateTime.TryParse(value, out dated)) { SqlDataSourceItsCalledTheSetupScreenOfScreenOne.InsertParameters["dated"].DefaultValue = value; } screenOne = ((System.Web.UI.WebControls.TextBox)GridViewItsCalledTheSetupScreenOfScreenOne.FooterRow.FindControl("TextBoxGridViewItsCalledTheSetupScreenOfScreenOneFooterTemplateScreenOne")).Text; SqlDataSourceItsCalledTheSetupScreenOfScreenOne.InsertParameters["ScreenOne"].DefaultValue = screenOne; SqlDataSourceItsCalledTheSetupScreenOfScreenOne.Insert(); GridViewItsCalledTheSetupScreenOfScreenOne.DataBind(); } catch (System.Exception exception) { exceptionMessage = "System.Exception: " + exception.Message; } if (exceptionMessage != null) { Feedback = exceptionMessage; return; } }
/// <summary>GridViewCharlesSimonyiInsert()</summary> public void GridViewCharlesSimonyiInsert ( Object sender, EventArgs e ) { int sequenceOrderId; DateTime dated; string hungarianNotation; string exceptionMessage = null; string value; try { value = ((System.Web.UI.WebControls.TextBox)GridViewCharlesSimonyi.FooterRow.FindControl("TextBoxGridViewCharlesSimonyiFooterTemplateSequenceOrderId")).Text; if (Int32.TryParse(value, out sequenceOrderId)) { SqlDataSourceCharlesSimonyi.InsertParameters["sequenceOrderId"].DefaultValue = value; } value = ((System.Web.UI.WebControls.TextBox)GridViewCharlesSimonyi.FooterRow.FindControl("TextBoxGridViewCharlesSimonyiFooterTemplateDated")).Text; if (DateTime.TryParse(value, out dated)) { SqlDataSourceCharlesSimonyi.InsertParameters["dated"].DefaultValue = value; } hungarianNotation = ((System.Web.UI.WebControls.TextBox)GridViewCharlesSimonyi.FooterRow.FindControl("TextBoxGridViewCharlesSimonyiFooterTemplateHungarianNotation")).Text; SqlDataSourceCharlesSimonyi.InsertParameters["HungarianNotation"].DefaultValue = hungarianNotation; SqlDataSourceCharlesSimonyi.Insert(); GridViewCharlesSimonyi.DataBind(); } catch (System.Exception exception) { exceptionMessage = "System.Exception: " + exception.Message; } if (exceptionMessage != null) { Feedback = exceptionMessage; return; } }
/// <summary>GridViewKarlSeguinInsert()</summary> public void GridViewKarlSeguinInsert ( Object sender, EventArgs e ) { int sequenceOrderId; DateTime dated; string EastBorderZeroDatabaseImplementationStephenKeshi; string exceptionMessage = null; string value; try { value = ((System.Web.UI.WebControls.TextBox)GridViewKarlSeguin.FooterRow.FindControl("TextBoxGridViewKarlSeguinFooterTemplateSequenceOrderId")).Text; if (Int32.TryParse(value, out sequenceOrderId)) { SqlDataSourceKarlSeguin.InsertParameters["sequenceOrderId"].DefaultValue = value; } value = ((System.Web.UI.WebControls.TextBox)GridViewKarlSeguin.FooterRow.FindControl("TextBoxGridViewKarlSeguinFooterTemplateDated")).Text; if (DateTime.TryParse(value, out dated)) { SqlDataSourceKarlSeguin.InsertParameters["dated"].DefaultValue = value; } EastBorderZeroDatabaseImplementationStephenKeshi = ((System.Web.UI.WebControls.TextBox)GridViewKarlSeguin.FooterRow.FindControl("TextBoxGridViewKarlSeguinFooterTemplateEastBorderZeroDatabaseImplementationStephenKeshi")).Text; SqlDataSourceKarlSeguin.InsertParameters["EastBorderZeroDatabaseImplementationStephenKeshi"].DefaultValue = EastBorderZeroDatabaseImplementationStephenKeshi; SqlDataSourceKarlSeguin.Insert(); GridViewKarlSeguin.DataBind(); } catch (System.Exception exception) { exceptionMessage = "System.Exception: " + exception.Message; } if (exceptionMessage != null) { Feedback = exceptionMessage; return; } }
/// <summary>GridViewJAFlevarisRealtyTrustReceiptInsert()</summary> public void GridViewJAFlevarisRealtyTrustReceiptInsert ( Object sender, EventArgs e ) { int sequenceOrderId; DateTime dated; DateTime date; Decimal admin; Decimal sinking; Decimal unallocated; Decimal outstanding; Decimal interest; Decimal paid; string description; string exceptionMessage = null; string value; try { value = ((System.Web.UI.WebControls.TextBox)GridViewJAFlevarisRealtyTrustReceipt.FooterRow.FindControl("TextBoxGridViewJAFlevarisRealtyTrustReceiptFooterTemplateSequenceOrderId")).Text; if (Int32.TryParse(value, out sequenceOrderId)) { SqlDataSourceJAFlevarisRealtyTrustReceipt.InsertParameters["sequenceOrderId"].DefaultValue = value; } value = ((System.Web.UI.WebControls.TextBox)GridViewJAFlevarisRealtyTrustReceipt.FooterRow.FindControl("TextBoxGridViewJAFlevarisRealtyTrustReceiptFooterTemplateDated")).Text; if (DateTime.TryParse(value, out dated)) { SqlDataSourceJAFlevarisRealtyTrustReceipt.InsertParameters["dated"].DefaultValue = value; } value = ((System.Web.UI.WebControls.TextBox)GridViewJAFlevarisRealtyTrustReceipt.FooterRow.FindControl("TextBoxGridViewJAFlevarisRealtyTrustReceiptFooterTemplatedate")).Text; if (DateTime.TryParse(value, out date)) { SqlDataSourceJAFlevarisRealtyTrustReceipt.InsertParameters["date"].DefaultValue = value; } description = ((System.Web.UI.WebControls.TextBox)GridViewJAFlevarisRealtyTrustReceipt.FooterRow.FindControl("TextBoxGridViewJAFlevarisRealtyTrustReceiptFooterTemplatedescription")).Text; SqlDataSourceJAFlevarisRealtyTrustReceipt.InsertParameters["description"].DefaultValue = description; value = ((System.Web.UI.WebControls.TextBox)GridViewJAFlevarisRealtyTrustReceipt.FooterRow.FindControl("TextBoxGridViewJAFlevarisRealtyTrustReceiptFooterTemplateadmin")).Text; if (Decimal.TryParse(value, out admin)) { SqlDataSourceJAFlevarisRealtyTrustReceipt.InsertParameters["admin"].DefaultValue = value; } value = ((System.Web.UI.WebControls.TextBox)GridViewJAFlevarisRealtyTrustReceipt.FooterRow.FindControl("TextBoxGridViewJAFlevarisRealtyTrustReceiptFooterTemplatesinking")).Text; if (Decimal.TryParse(value, out sinking)) { SqlDataSourceJAFlevarisRealtyTrustReceipt.InsertParameters["sinking"].DefaultValue = value; } value = ((System.Web.UI.WebControls.TextBox)GridViewJAFlevarisRealtyTrustReceipt.FooterRow.FindControl("TextBoxGridViewJAFlevarisRealtyTrustReceiptFooterTemplateunallocated")).Text; if (Decimal.TryParse(value, out unallocated)) { SqlDataSourceJAFlevarisRealtyTrustReceipt.InsertParameters["unallocated"].DefaultValue = value; } value = ((System.Web.UI.WebControls.TextBox)GridViewJAFlevarisRealtyTrustReceipt.FooterRow.FindControl("TextBoxGridViewJAFlevarisRealtyTrustReceiptFooterTemplateoutstanding")).Text; if (Decimal.TryParse(value, out outstanding)) { SqlDataSourceJAFlevarisRealtyTrustReceipt.InsertParameters["outstanding"].DefaultValue = value; } value = ((System.Web.UI.WebControls.TextBox)GridViewJAFlevarisRealtyTrustReceipt.FooterRow.FindControl("TextBoxGridViewJAFlevarisRealtyTrustReceiptFooterTemplateinterest")).Text; if (Decimal.TryParse(value, out interest)) { SqlDataSourceJAFlevarisRealtyTrustReceipt.InsertParameters["interest"].DefaultValue = value; } value = ((System.Web.UI.WebControls.TextBox)GridViewJAFlevarisRealtyTrustReceipt.FooterRow.FindControl("TextBoxGridViewJAFlevarisRealtyTrustReceiptFooterTemplatepaid")).Text; if (Decimal.TryParse(value, out paid)) { SqlDataSourceJAFlevarisRealtyTrustReceipt.InsertParameters["paid"].DefaultValue = value; } SqlDataSourceJAFlevarisRealtyTrustReceipt.Insert(); GridViewJAFlevarisRealtyTrustReceipt.DataBind(); } catch (System.Exception exception) { exceptionMessage = "System.Exception: " + exception.Message; } if (exceptionMessage != null) { Feedback = exceptionMessage; return; } }
/// <summary>GridViewNobleHomesLevyNoticeInsert()</summary> public void GridViewNobleHomesLevyNoticeInsert ( Object sender, EventArgs e ) { int sequenceOrderId; DateTime dated; DateTime date; Decimal admin; Decimal sinking; Decimal misc; Decimal total; Decimal balance; string description; string exceptionMessage = null; string value; try { value = ((System.Web.UI.WebControls.TextBox)GridViewNobleHomesLevyNotice.FooterRow.FindControl("TextBoxGridViewNobleHomesLevyNoticeFooterTemplateSequenceOrderId")).Text; if (Int32.TryParse(value, out sequenceOrderId)) { SqlDataSourceNobleHomesLevyNotice.InsertParameters["sequenceOrderId"].DefaultValue = value; } value = ((System.Web.UI.WebControls.TextBox)GridViewNobleHomesLevyNotice.FooterRow.FindControl("TextBoxGridViewNobleHomesLevyNoticeFooterTemplateDated")).Text; if (DateTime.TryParse(value, out dated)) { SqlDataSourceNobleHomesLevyNotice.InsertParameters["dated"].DefaultValue = value; } value = ((System.Web.UI.WebControls.TextBox)GridViewNobleHomesLevyNotice.FooterRow.FindControl("TextBoxGridViewNobleHomesLevyNoticeFooterTemplatedate")).Text; if (DateTime.TryParse(value, out date)) { SqlDataSourceNobleHomesLevyNotice.InsertParameters["date"].DefaultValue = value; } description = ((System.Web.UI.WebControls.TextBox)GridViewNobleHomesLevyNotice.FooterRow.FindControl("TextBoxGridViewNobleHomesLevyNoticeFooterTemplatedescription")).Text; SqlDataSourceNobleHomesLevyNotice.InsertParameters["description"].DefaultValue = description; value = ((System.Web.UI.WebControls.TextBox)GridViewNobleHomesLevyNotice.FooterRow.FindControl("TextBoxGridViewNobleHomesLevyNoticeFooterTemplateadmin")).Text; if (Decimal.TryParse(value, out admin)) { SqlDataSourceNobleHomesLevyNotice.InsertParameters["admin"].DefaultValue = value; } value = ((System.Web.UI.WebControls.TextBox)GridViewNobleHomesLevyNotice.FooterRow.FindControl("TextBoxGridViewNobleHomesLevyNoticeFooterTemplatesinking")).Text; if (Decimal.TryParse(value, out sinking)) { SqlDataSourceNobleHomesLevyNotice.InsertParameters["sinking"].DefaultValue = value; } value = ((System.Web.UI.WebControls.TextBox)GridViewNobleHomesLevyNotice.FooterRow.FindControl("TextBoxGridViewNobleHomesLevyNoticeFooterTemplatemisc")).Text; if (Decimal.TryParse(value, out misc)) { SqlDataSourceNobleHomesLevyNotice.InsertParameters["misc"].DefaultValue = value; } value = ((System.Web.UI.WebControls.TextBox)GridViewNobleHomesLevyNotice.FooterRow.FindControl("TextBoxGridViewNobleHomesLevyNoticeFooterTemplatetotal")).Text; if (Decimal.TryParse(value, out total)) { SqlDataSourceNobleHomesLevyNotice.InsertParameters["total"].DefaultValue = value; } value = ((System.Web.UI.WebControls.TextBox)GridViewNobleHomesLevyNotice.FooterRow.FindControl("TextBoxGridViewNobleHomesLevyNoticeFooterTemplateBalance")).Text; if (Decimal.TryParse(value, out balance)) { SqlDataSourceNobleHomesLevyNotice.InsertParameters["Balance"].DefaultValue = value; } SqlDataSourceNobleHomesLevyNotice.Insert(); GridViewNobleHomesLevyNotice.DataBind(); } catch (System.Exception exception) { exceptionMessage = "System.Exception: " + exception.Message; } if (exceptionMessage != null) { Feedback = exceptionMessage; return; } }
/// <summary>GridViewLJHookerTaxInvoiceInsert()</summary> public void GridViewLJHookerTaxInvoiceInsert ( Object sender, EventArgs e ) { int accountNumber; int sequenceOrderId; DateTime dated; DateTime reference; Decimal debit; Decimal debitIncGST; Decimal credit; Decimal creditIncGST; string details; string DX; string exceptionMessage = null; string value; try { value = ((System.Web.UI.WebControls.TextBox)GridViewLJHookerTaxInvoice.FooterRow.FindControl("TextBoxGridViewLJHookerTaxInvoiceFooterTemplateSequenceOrderId")).Text; if (Int32.TryParse(value, out sequenceOrderId)) { SqlDataSourceLJHookerTaxInvoice.InsertParameters["sequenceOrderId"].DefaultValue = value; } value = ((System.Web.UI.WebControls.TextBox)GridViewLJHookerTaxInvoice.FooterRow.FindControl("TextBoxGridViewLJHookerTaxInvoiceFooterTemplateDated")).Text; if (DateTime.TryParse(value, out dated)) { SqlDataSourceLJHookerTaxInvoice.InsertParameters["dated"].DefaultValue = value; } DX = ((System.Web.UI.WebControls.TextBox)GridViewLJHookerTaxInvoice.FooterRow.FindControl("TextBoxGridViewLJHookerTaxInvoiceFooterTemplateDX")).Text; SqlDataSourceLJHookerTaxInvoice.InsertParameters["DX"].DefaultValue = DX; value = ((System.Web.UI.WebControls.TextBox)GridViewLJHookerTaxInvoice.FooterRow.FindControl("TextBoxGridViewLJHookerTaxInvoiceFooterTemplateAccountNumber")).Text; if (Int32.TryParse(value, out accountNumber)) { SqlDataSourceLJHookerTaxInvoice.InsertParameters["accountNumber"].DefaultValue = value; } value = ((System.Web.UI.WebControls.TextBox)GridViewLJHookerTaxInvoice.FooterRow.FindControl("TextBoxGridViewLJHookerTaxInvoiceFooterTemplateReference")).Text; if (DateTime.TryParse(value, out reference)) { SqlDataSourceLJHookerTaxInvoice.InsertParameters["reference"].DefaultValue = value; } details = ((System.Web.UI.WebControls.TextBox)GridViewLJHookerTaxInvoice.FooterRow.FindControl("TextBoxGridViewLJHookerTaxInvoiceFooterTemplateDetails")).Text; SqlDataSourceLJHookerTaxInvoice.InsertParameters["details"].DefaultValue = details; value = ((System.Web.UI.WebControls.TextBox)GridViewLJHookerTaxInvoice.FooterRow.FindControl("TextBoxGridViewLJHookerTaxInvoiceFooterTemplateDebit")).Text; if (Decimal.TryParse(value, out debit)) { SqlDataSourceLJHookerTaxInvoice.InsertParameters["debit"].DefaultValue = value; } value = ((System.Web.UI.WebControls.TextBox)GridViewLJHookerTaxInvoice.FooterRow.FindControl("TextBoxGridViewLJHookerTaxInvoiceFooterTemplateDebitIncGST")).Text; if (Decimal.TryParse(value, out debitIncGST)) { SqlDataSourceLJHookerTaxInvoice.InsertParameters["debitIncGST"].DefaultValue = value; } value = ((System.Web.UI.WebControls.TextBox)GridViewLJHookerTaxInvoice.FooterRow.FindControl("TextBoxGridViewLJHookerTaxInvoiceFooterTemplateCredit")).Text; if (Decimal.TryParse(value, out credit)) { SqlDataSourceLJHookerTaxInvoice.InsertParameters["credit"].DefaultValue = value; } value = ((System.Web.UI.WebControls.TextBox)GridViewLJHookerTaxInvoice.FooterRow.FindControl("TextBoxGridViewLJHookerTaxInvoiceFooterTemplateCreditIncGST")).Text; if (Decimal.TryParse(value, out creditIncGST)) { SqlDataSourceLJHookerTaxInvoice.InsertParameters["creditIncGST"].DefaultValue = value; } SqlDataSourceLJHookerTaxInvoice.Insert(); GridViewLJHookerTaxInvoice.DataBind(); } catch (System.Exception exception) { exceptionMessage = "System.Exception: " + exception.Message; } if (exceptionMessage != null) { Feedback = exceptionMessage; return; } }
}//public void DetailsViewURI_ItemInserted /// <summary>DetailsViewURI_ItemInserting</summary> public void DetailsViewURI_ItemInserting ( Object sender, DetailsViewInsertEventArgs detailsViewInsertEventArgs ) { int sequenceOrderId = -1; DateTime dated = DateTime.MinValue; string exceptionMessage = null; string keyword = null; string title = null; string uri = null; IOrderedDictionary iOrderedDictionary; try { /* iOrderedDictionary = detailsViewInsertEventArgs.Values; feedback = ""; foreach ( DictionaryEntry dictionaryEntry in iOrderedDictionary ) { feedback += dictionaryEntry.Key; if ( dictionaryEntry.Value != null ) { feedback += " = " + dictionaryEntry.Value + " | "; }//if ( dictionaryEntry.Value != null ) }//foreach ( DictionaryEntry dictionaryEntry in iOrderedDictionary ) return; */ if ( detailsViewInsertEventArgs.Values["Dated"] != null ) { DateTime.TryParse( detailsViewInsertEventArgs.Values["Dated"].ToString(), out dated ); } if ( detailsViewInsertEventArgs.Values["SequenceOrderId"] != null ) { Int32.TryParse( detailsViewInsertEventArgs.Values["SequenceOrderId"].ToString(), out sequenceOrderId ); } if ( detailsViewInsertEventArgs.Values["URI"] != null ) { uri = detailsViewInsertEventArgs.Values["URI"].ToString(); } if ( detailsViewInsertEventArgs.Values["Title"] != null ) { title = detailsViewInsertEventArgs.Values["Title"].ToString(); } if ( detailsViewInsertEventArgs.Values["Keyword"] != null ) { keyword = detailsViewInsertEventArgs.Values["Keyword"].ToString(); } if ( sequenceOrderId > 0 ) { SqlDataSourceURIDetailsView.InsertParameters["sequenceOrderId"].DefaultValue = System.Convert.ToString( sequenceOrderId ); } if ( dated != DateTime.MinValue ) { SqlDataSourceURIDetailsView.InsertParameters["dated"].DefaultValue = System.Convert.ToString( dated ); } SqlDataSourceURIDetailsView.InsertParameters["keyword"].DefaultValue = keyword; SqlDataSourceURIDetailsView.InsertParameters["title"].DefaultValue = title; SqlDataSourceURIDetailsView.InsertParameters["uri"].DefaultValue = uri; SqlDataSourceURIDetailsView.Insert(); }//try catch ( Exception exception ) { exceptionMessage = exception.Message; } if ( exceptionMessage != null ) { Feedback = exceptionMessage; return; } }//void DetailsViewURI_ItemInserting()
/// <summary> /// GridViewAussieHomeLoansTransactionHistoryInsert /// </summary> public void GridViewAussieHomeLoansTransactionHistoryInsert ( Object sender, EventArgs e ) { int loanNumber; int sequenceOrderId; DateTime dated; DateTime transactionDate; DateTime transactionEffectiveDate; Decimal transactionAmount; string description; string exceptionMessage = null; string transactionDRCR; string value; try { value = ((System.Web.UI.WebControls.TextBox)GridViewAussieHomeLoansTransactionHistory.FooterRow.FindControl("TextBoxGridViewAussieHomeLoansTransactionHistoryFooterTemplateSequenceOrderId")).Text; if (Int32.TryParse(value, out sequenceOrderId)) { SqlDataSourceAussieHomeLoansTransactionHistory.InsertParameters["sequenceOrderId"].DefaultValue = value; } value = ((System.Web.UI.WebControls.TextBox)GridViewAussieHomeLoansTransactionHistory.FooterRow.FindControl("TextBoxGridViewAussieHomeLoansTransactionHistoryFooterTemplateDated")).Text; if (DateTime.TryParse(value, out dated)) { SqlDataSourceAussieHomeLoansTransactionHistory.InsertParameters["dated"].DefaultValue = value; } value = ((System.Web.UI.WebControls.TextBox)GridViewAussieHomeLoansTransactionHistory.FooterRow.FindControl("TextBoxGridViewAussieHomeLoansTransactionHistoryFooterTemplateLoanNumber")).Text; if (Int32.TryParse(value, out loanNumber)) { SqlDataSourceAussieHomeLoansTransactionHistory.InsertParameters["loanNumber"].DefaultValue = value; } value = ((System.Web.UI.WebControls.TextBox)GridViewAussieHomeLoansTransactionHistory.FooterRow.FindControl("TextBoxGridViewAussieHomeLoansTransactionHistoryFooterTemplateTransactionDate")).Text; if (DateTime.TryParse(value, out transactionDate)) { SqlDataSourceAussieHomeLoansTransactionHistory.InsertParameters["transactionDate"].DefaultValue = value; } value = ((System.Web.UI.WebControls.TextBox)GridViewAussieHomeLoansTransactionHistory.FooterRow.FindControl("TextBoxGridViewAussieHomeLoansTransactionHistoryFooterTemplateTransactionEffectiveDate")).Text; if (DateTime.TryParse(value, out transactionEffectiveDate)) { SqlDataSourceAussieHomeLoansTransactionHistory.InsertParameters["transactionEffectiveDate"].DefaultValue = value; } value = ((System.Web.UI.WebControls.TextBox)GridViewAussieHomeLoansTransactionHistory.FooterRow.FindControl("TextBoxGridViewAussieHomeLoansTransactionHistoryFooterTemplateTransactionAmount")).Text; if (Decimal.TryParse(value, out transactionAmount)) { SqlDataSourceAussieHomeLoansTransactionHistory.InsertParameters["transactionAmount"].DefaultValue = value; } transactionDRCR = ((System.Web.UI.WebControls.DropDownList)GridViewAussieHomeLoansTransactionHistory.FooterRow.FindControl("DropDownListGridViewAussieHomeLoansTransactionHistoryFooterTemplateTransactionDRCR")).SelectedValue; SqlDataSourceAussieHomeLoansTransactionHistory.InsertParameters["transactionDRCR"].DefaultValue = transactionDRCR; description = ((System.Web.UI.WebControls.DropDownList)GridViewAussieHomeLoansTransactionHistory.FooterRow.FindControl("DropDownListGridViewAussieHomeLoansTransactionHistoryFooterTemplateDescription")).SelectedValue; SqlDataSourceAussieHomeLoansTransactionHistory.InsertParameters["description"].DefaultValue = description; SqlDataSourceAussieHomeLoansTransactionHistory.Insert(); GridViewAussieHomeLoansTransactionHistory.DataBind(); } catch (System.Exception exception) { exceptionMessage = "System.Exception: " + exception.Message; } if (exceptionMessage != null) { Feedback = exceptionMessage; return; } }
/// <summary> /// GridViewAussieHomeLoansStatementInsert() /// </summary> public void GridViewAussieHomeLoansStatementInsert ( Object sender, EventArgs e ) { int loanNumber; int sequenceOrderId; DateTime date; DateTime dated; Decimal balance; Decimal credit; Decimal debit; string description; string exceptionMessage = null; string value; try { value = ((System.Web.UI.WebControls.TextBox)GridViewAussieHomeLoansStatement.FooterRow.FindControl("TextBoxGridViewAussieHomeLoansStatementFooterTemplateSequenceOrderId")).Text; if (Int32.TryParse(value, out sequenceOrderId)) { SqlDataSourceAussieHomeLoansStatement.InsertParameters["sequenceOrderId"].DefaultValue = value; } value = ((System.Web.UI.WebControls.TextBox)GridViewAussieHomeLoansStatement.FooterRow.FindControl("TextBoxGridViewAussieHomeLoansStatementFooterTemplateDated")).Text; if (DateTime.TryParse(value, out dated)) { SqlDataSourceAussieHomeLoansStatement.InsertParameters["dated"].DefaultValue = value; } value = ((System.Web.UI.WebControls.TextBox)GridViewAussieHomeLoansStatement.FooterRow.FindControl("TextBoxGridViewAussieHomeLoansStatementFooterTemplateLoanNumber")).Text; if (Int32.TryParse(value, out loanNumber)) { SqlDataSourceAussieHomeLoansStatement.InsertParameters["loanNumber"].DefaultValue = value; } value = ((System.Web.UI.WebControls.TextBox)GridViewAussieHomeLoansStatement.FooterRow.FindControl("TextBoxGridViewAussieHomeLoansStatementFooterTemplateDate")).Text; if (DateTime.TryParse(value, out date)) { SqlDataSourceAussieHomeLoansStatement.InsertParameters["date"].DefaultValue = value; } //description = (( System.Web.UI.WebControls.DropDownList ) GridViewAussieHomeLoansStatement.FooterRow.FindControl("DropDownListGridViewAussieHomeLoansStatementFooterTemplateDescription")).SelectedValue; description = ((System.Web.UI.WebControls.TextBox)GridViewAussieHomeLoansStatement.FooterRow.FindControl("TextBoxGridViewAussieHomeLoansStatementFooterTemplateDescription")).Text; SqlDataSourceAussieHomeLoansStatement.InsertParameters["description"].DefaultValue = description; value = ((System.Web.UI.WebControls.TextBox)GridViewAussieHomeLoansStatement.FooterRow.FindControl("TextBoxGridViewAussieHomeLoansStatementFooterTemplateDebit")).Text; if (Decimal.TryParse(value, out debit)) { SqlDataSourceAussieHomeLoansStatement.InsertParameters["debit"].DefaultValue = value; } value = ((System.Web.UI.WebControls.TextBox)GridViewAussieHomeLoansStatement.FooterRow.FindControl("TextBoxGridViewAussieHomeLoansStatementFooterTemplateCredit")).Text; if (Decimal.TryParse(value, out credit)) { SqlDataSourceAussieHomeLoansStatement.InsertParameters["credit"].DefaultValue = value; } value = ((System.Web.UI.WebControls.TextBox)GridViewAussieHomeLoansStatement.FooterRow.FindControl("TextBoxGridViewAussieHomeLoansStatementFooterTemplateBalance")).Text; if (Decimal.TryParse(value, out balance)) { SqlDataSourceAussieHomeLoansStatement.InsertParameters["balance"].DefaultValue = value; } SqlDataSourceAussieHomeLoansStatement.Insert(); GridViewAussieHomeLoansStatement.DataBind(); } catch (System.Exception exception) { exceptionMessage = "System.Exception: " + exception.Message; } if (exceptionMessage != null) { Feedback = exceptionMessage; return; } }
/// <summary> /// GridViewAussieHomeLoansAccountBalanceInsert() /// </summary> public void GridViewAussieHomeLoansAccountBalanceInsert ( Object sender, EventArgs e ) { int loanNumber; int sequenceOrderId; DateTime dated; DateTime nextDueDateRepayment; Decimal currentBalance; Decimal interestRate; Decimal redrawAvailable; Decimal repaymentAmount; string loanType; string exceptionMessage = null; string repaymentFrequency; string value; try { value = ((System.Web.UI.WebControls.TextBox)GridViewAussieHomeLoansAccountBalance.FooterRow.FindControl("TextBoxGridViewAussieHomeLoansAccountBalanceFooterTemplateSequenceOrderId")).Text; if (Int32.TryParse(value, out sequenceOrderId)) { SqlDataSourceAussieHomeLoansAccountBalance.InsertParameters["sequenceOrderId"].DefaultValue = value; } value = ((System.Web.UI.WebControls.TextBox)GridViewAussieHomeLoansAccountBalance.FooterRow.FindControl("TextBoxGridViewAussieHomeLoansAccountBalanceFooterTemplateDated")).Text; if (DateTime.TryParse(value, out dated)) { SqlDataSourceAussieHomeLoansAccountBalance.InsertParameters["dated"].DefaultValue = value; } value = ((System.Web.UI.WebControls.TextBox)GridViewAussieHomeLoansAccountBalance.FooterRow.FindControl("TextBoxGridViewAussieHomeLoansAccountBalanceFooterTemplateLoanNumber")).Text; if (Int32.TryParse(value, out loanNumber)) { SqlDataSourceAussieHomeLoansAccountBalance.InsertParameters["loanNumber"].DefaultValue = value; } loanType = ((System.Web.UI.WebControls.DropDownList)GridViewAussieHomeLoansAccountBalance.FooterRow.FindControl("DropDownListGridViewAussieHomeLoansAccountBalanceFooterTemplateLoanType")).SelectedValue; SqlDataSourceAussieHomeLoansAccountBalance.InsertParameters["loanType"].DefaultValue = loanType; value = ((System.Web.UI.WebControls.TextBox)GridViewAussieHomeLoansAccountBalance.FooterRow.FindControl("TextBoxGridViewAussieHomeLoansAccountBalanceFooterTemplateInterestRate")).Text; if (Decimal.TryParse(value, out interestRate)) { SqlDataSourceAussieHomeLoansAccountBalance.InsertParameters["interestRate"].DefaultValue = value; } value = ((System.Web.UI.WebControls.TextBox)GridViewAussieHomeLoansAccountBalance.FooterRow.FindControl("TextBoxGridViewAussieHomeLoansAccountBalanceFooterTemplateCurrentBalance")).Text; if (Decimal.TryParse(value, out currentBalance)) { SqlDataSourceAussieHomeLoansAccountBalance.InsertParameters["currentBalance"].DefaultValue = value; } value = ((System.Web.UI.WebControls.TextBox)GridViewAussieHomeLoansAccountBalance.FooterRow.FindControl("TextBoxGridViewAussieHomeLoansAccountBalanceFooterTemplateRedrawAvailable")).Text; if (Decimal.TryParse(value, out redrawAvailable)) { SqlDataSourceAussieHomeLoansAccountBalance.InsertParameters["redrawAvailable"].DefaultValue = value; } repaymentFrequency = ((System.Web.UI.WebControls.DropDownList)GridViewAussieHomeLoansAccountBalance.FooterRow.FindControl("DropDownListGridViewAussieHomeLoansAccountBalanceFooterTemplateRepaymentFrequency")).SelectedValue; SqlDataSourceAussieHomeLoansAccountBalance.InsertParameters["repaymentFrequency"].DefaultValue = repaymentFrequency; value = ((System.Web.UI.WebControls.TextBox)GridViewAussieHomeLoansAccountBalance.FooterRow.FindControl("TextBoxGridViewAussieHomeLoansAccountBalanceFooterTemplateRepaymentAmount")).Text; if (Decimal.TryParse(value, out repaymentAmount)) { SqlDataSourceAussieHomeLoansAccountBalance.InsertParameters["repaymentAmount"].DefaultValue = value; } value = ((System.Web.UI.WebControls.TextBox)GridViewAussieHomeLoansAccountBalance.FooterRow.FindControl("TextBoxGridViewAussieHomeLoansAccountBalanceFooterTemplateNextDueDateRepayment")).Text; if (DateTime.TryParse(value, out nextDueDateRepayment)) { SqlDataSourceAussieHomeLoansAccountBalance.InsertParameters["nextDueDateRepayment"].DefaultValue = value; } SqlDataSourceAussieHomeLoansAccountBalance.Insert(); GridViewAussieHomeLoansAccountBalance.DataBind(); } catch (System.Exception exception) { exceptionMessage = "System.Exception: " + exception.Message; } if (exceptionMessage != null) { Feedback = exceptionMessage; return; } }
public static bool DuplicateProject(string projectID, string projectNewName) { SqlDataSource dataSource = new SqlDataSource(); // Super bad? Copy pasta from web.config dataSource.ConnectionString = @"Data Source=(LocalDB)\v11.0;AttachDbFilename=|DataDirectory|\sunspace_db.mdf;Integrated Security=True;Connect Timeout=30"; Project aProject = new Project(); System.Data.DataView selectProject = new System.Data.DataView(); string sqlSelect; string sqlInsert; List<string> tableNames = new List<string>(); int newProjectID; // New project ID for all the compenents of a project int tableCount; // Number of tables // Select the project sqlSelect = "SELECT project_type," + "installation_type," + "customer_id," + "user_id," + "date_created," + "status," + "revised_date," + "revised_user_id," + "msrp," + "project_notes," + "hidden," + "cut_pitch" + " FROM Projects" + " WHERE project_ID = " + projectID + ";"; dataSource.SelectCommand = sqlSelect; selectProject = (System.Data.DataView)dataSource.Select(System.Web.UI.DataSourceSelectArguments.Empty); Debug.WriteLine(selectProject[0].Row[0]); // Insert the new project with the duplicated data! sqlInsert = "INSERT INTO Projects(project_type, " + "installation_type, " + "customer_id, " + "user_id, " + "date_created, " + "status, " + "revised_date, " + "revised_user_id, " + "msrp, " + "project_notes, " + "hidden, " + "cut_pitch, " + "project_name " + ") VALUES ( '" + selectProject[0].Row[0] + "'," + "'" + selectProject[0].Row[1] + "'," + "'" + selectProject[0].Row[2] + "'," + "'" + selectProject[0].Row[3] + "'," + "'" + selectProject[0].Row[4] + "'," + "'" + selectProject[0].Row[5] + "'," + "'" + selectProject[0].Row[6] + "'," + "'" + selectProject[0].Row[7] + "'," + "'" + selectProject[0].Row[8] + "'," + "'" + selectProject[0].Row[9] + "'," + "'" + selectProject[0].Row[10] + "'," + "'" + selectProject[0].Row[11] + "'," + "'" + projectNewName + "' ); "; //+ //" WHERE project_ID = '" + projectID + "';"; dataSource.InsertCommand = sqlInsert; dataSource.Insert(); // Grab project id from the last insert! sqlSelect = "SELECT project_ID from Projects WHERE project_ID = IDENT_CURRENT('Projects');"; dataSource.SelectCommand = sqlSelect; selectProject = (System.Data.DataView)dataSource.Select(System.Web.UI.DataSourceSelectArguments.Empty); // Set new project id newProjectID = (int)selectProject[0].Row[0]; Debug.WriteLine(selectProject[0].Row[0]); // Get table count sqlSelect = "Select Count(*) From INFORMATION_SCHEMA.COLUMNS WHERE COLUMN_NAME LIKE 'project_id' AND TABLE_NAME <> 'projects'"; dataSource.SelectCommand = sqlSelect; selectProject = (System.Data.DataView)dataSource.Select(System.Web.UI.DataSourceSelectArguments.Empty); // Set table count tableCount = (int)selectProject[0].Row[0]; Debug.WriteLine(selectProject[0].Row[0]); // Essentially this gets a compenent table info and re-inserts it with the new project ID for (int index = 0; index < tableCount; index++) { // Get table names sqlSelect = "SELECT TABLE_NAME From INFORMATION_SCHEMA.COLUMNS WHERE COLUMN_NAME LIKE 'project_id' AND TABLE_NAME <> 'projects' ORDER BY TABLE_NAME ASC OFFSET "+ index +" ROWS FETCH NEXT 1 ROWS ONLY"; dataSource.SelectCommand = sqlSelect; selectProject = (System.Data.DataView)dataSource.Select(System.Web.UI.DataSourceSelectArguments.Empty); tableNames.Add((string)selectProject[0].Row[0]); Debug.WriteLine("Table Name: " + selectProject[0].Row[0]); Debug.WriteLine("Table Count:" + tableNames.Count()); // Select rows with the old project id sqlSelect = "SELECT * FROM " + selectProject[0].Row[0] + " WHERE project_ID = " + projectID; dataSource.SelectCommand = sqlSelect; selectProject = (System.Data.DataView)dataSource.Select(System.Web.UI.DataSourceSelectArguments.Empty); // // If we actually need this table.. // if (selectProject.Count > 0) { Debug.WriteLine(selectProject[0].Row[0]); // Start the insert statement sqlInsert = "INSERT INTO " + tableNames[index] + " VALUES ("; // Inserts the values for (int index2 = 0; index2 < selectProject[0].Row.ItemArray.Count(); index2++) { Debug.WriteLine(selectProject[0].Row[index2]); if (index2 == 0) sqlInsert += "'" + newProjectID + "', "; else if (index2 != (selectProject[0].Row.ItemArray.Count() - 1)) sqlInsert += "'" + selectProject[0].Row[index2] + "', "; else sqlInsert += "'" + selectProject[0].Row[index2] + "'"; } // Close the insert sqlInsert += ");"; Debug.WriteLine(sqlInsert); // Actually insert the data dataSource.InsertCommand = sqlInsert; dataSource.Insert(); } } return true; }