G
gjtired
Currently I am retrieving values from a dataset and assigning the
values to a textbox. I then assign the value from the textbox to a
variable. I don't need the values in the textbox at all. I'm sure there
is an easier way than I'm doing it. Any suggestions or help would be
appreciated. Below is a snippet of code to show what I'm currently
doing.
string cmdQuestionEdit="SELECT Question_Subject, "+
"Question_Weight, "+
"QuestionType_ID, " +
"Question_Status, "+
"Question_QuestionContent, "+
"Quiz_ID, " +
"SortType_ID, "+
"Quiz_Version, " +
"Quiz_Number, " +
"Question_Version, " +
"Question_Number, " +
"QuestionType_ID " +
"FROM Question " +
"Where '"+txtQuestionID.Text+"' = " +
"Question_ID and '"+txtQuizID.Text+"' " +
"= Quiz_ID ";
sqlConnection1.Open();
SqlDataAdapter daEdit=new SqlDataAdapter(cmdQuestionEdit,
sqlConnection1);
daEdit.Fill(dsMain1,"Question");
DataTable dtEdit = dsMain1.Tables["Question"];
foreach (DataRow questionRow in dtEdit.Rows)
{
txtVersion.Text = questionRow["Question_Version"].ToString
().Trim();
txtNumber.Text = questionRow["Question_Number"].ToString
().Trim();
}//end for
//Edit quiz
//get values fom drop down list
valEditQuizVersion = int.Parse(txtVersion.Text);
valEditQuizNumber = int.Parse(txtNumber.Text);
values to a textbox. I then assign the value from the textbox to a
variable. I don't need the values in the textbox at all. I'm sure there
is an easier way than I'm doing it. Any suggestions or help would be
appreciated. Below is a snippet of code to show what I'm currently
doing.
string cmdQuestionEdit="SELECT Question_Subject, "+
"Question_Weight, "+
"QuestionType_ID, " +
"Question_Status, "+
"Question_QuestionContent, "+
"Quiz_ID, " +
"SortType_ID, "+
"Quiz_Version, " +
"Quiz_Number, " +
"Question_Version, " +
"Question_Number, " +
"QuestionType_ID " +
"FROM Question " +
"Where '"+txtQuestionID.Text+"' = " +
"Question_ID and '"+txtQuizID.Text+"' " +
"= Quiz_ID ";
sqlConnection1.Open();
SqlDataAdapter daEdit=new SqlDataAdapter(cmdQuestionEdit,
sqlConnection1);
daEdit.Fill(dsMain1,"Question");
DataTable dtEdit = dsMain1.Tables["Question"];
foreach (DataRow questionRow in dtEdit.Rows)
{
txtVersion.Text = questionRow["Question_Version"].ToString
().Trim();
txtNumber.Text = questionRow["Question_Number"].ToString
().Trim();
}//end for
//Edit quiz
//get values fom drop down list
valEditQuizVersion = int.Parse(txtVersion.Text);
valEditQuizNumber = int.Parse(txtNumber.Text);