G
gj
Hi,
I'm trying to update a sql database from a web form using text boxes.
I'm trying to learn C# on my own so I am at a complete loss. I created
my sql connection, data adapter, dataset and data view in the visual
studio designer. I'm trying to keep a history of the record so instead
of editing the record I insert a new record with my changes. Instead
of the changes, it inserts the orginal record. Below is the part of
the code. Any help would be appreiated.
else if (txtTask.Text.Trim() == "1")
{
//assign values to variables
valName = txtName.Text.ToString();
valStatus = txtStatus.Text.ToString();
valQuestionsPerPage = short.Parse(txtQuestionsPerPage.Text);
valRetakeOption = int.Parse(drpRetakeOption.SelectedValue);
valPassGrade = short.Parse(txtPassGrade.Text);
valAuthor = txtAuthor.Text.ToString();
valUserID = "jongay";
valSortType = int.Parse(drpSortType.SelectedValue);
valNotifyOptions = int.Parse(drpNotifyOptions.SelectedValue);
valGradeScale = int.Parse(drpGradeScale.SelectedValue);
valNumber = int.Parse(txtAQQuizID.Text);
valEffectiveDate = DateTime.Parse(txtEffectiveDate.Text);
valActivityDate = DateTime.Now;
dsMain.QuizRow drv = dsMain1.Quiz.NewQuizRow();
drv.Quiz_Name = valName;
drv.Quiz_Status = valStatus;
drv.Quiz_Questions_PerPage = valQuestionsPerPage;
drv.Quiz_PassGrade = valPassGrade;
drv.Quiz_User_ID = valUserID;
drv.Quiz_Author = valAuthor;
drv.Quiz_Activity_Date = valActivityDate;
drv.SortType_ID = valSortType;
drv.NotifyOptions_ID = valNotifyOptions;
drv.GradeScale_ID = valGradeScale;
drv.RetakeOption_ID = valRetakeOption;
drv.Quiz_Effective_Date = valEffectiveDate;
drv.Quiz_Number = valNumber;
dsMain1.Quiz.AddQuizRow(drv);
daQuiz.Update(dsMain1, "Quiz");
} //end if
I'm trying to update a sql database from a web form using text boxes.
I'm trying to learn C# on my own so I am at a complete loss. I created
my sql connection, data adapter, dataset and data view in the visual
studio designer. I'm trying to keep a history of the record so instead
of editing the record I insert a new record with my changes. Instead
of the changes, it inserts the orginal record. Below is the part of
the code. Any help would be appreiated.
else if (txtTask.Text.Trim() == "1")
{
//assign values to variables
valName = txtName.Text.ToString();
valStatus = txtStatus.Text.ToString();
valQuestionsPerPage = short.Parse(txtQuestionsPerPage.Text);
valRetakeOption = int.Parse(drpRetakeOption.SelectedValue);
valPassGrade = short.Parse(txtPassGrade.Text);
valAuthor = txtAuthor.Text.ToString();
valUserID = "jongay";
valSortType = int.Parse(drpSortType.SelectedValue);
valNotifyOptions = int.Parse(drpNotifyOptions.SelectedValue);
valGradeScale = int.Parse(drpGradeScale.SelectedValue);
valNumber = int.Parse(txtAQQuizID.Text);
valEffectiveDate = DateTime.Parse(txtEffectiveDate.Text);
valActivityDate = DateTime.Now;
dsMain.QuizRow drv = dsMain1.Quiz.NewQuizRow();
drv.Quiz_Name = valName;
drv.Quiz_Status = valStatus;
drv.Quiz_Questions_PerPage = valQuestionsPerPage;
drv.Quiz_PassGrade = valPassGrade;
drv.Quiz_User_ID = valUserID;
drv.Quiz_Author = valAuthor;
drv.Quiz_Activity_Date = valActivityDate;
drv.SortType_ID = valSortType;
drv.NotifyOptions_ID = valNotifyOptions;
drv.GradeScale_ID = valGradeScale;
drv.RetakeOption_ID = valRetakeOption;
drv.Quiz_Effective_Date = valEffectiveDate;
drv.Quiz_Number = valNumber;
dsMain1.Quiz.AddQuizRow(drv);
daQuiz.Update(dsMain1, "Quiz");
} //end if