citizenzen
Programmer
Hello.
I am updating information in a database based on the values of a gridview. I need to allow the user to be able to add multiple bits of information, like barcode and format, based on the contents of the selected record.
So, if record XYZ was SELECTED and 10 COPIES needed to be created, there should be 10 fields for barcode and format in the datagrid, while library item is not looped (but is still a field option). I don't know how to go about this and my current try is definitely incorrect. is this even possible or do i need to try looping through a regular form?
here's what I have based on a button_click event which has BindForm() within:
=================================================================
I am updating information in a database based on the values of a gridview. I need to allow the user to be able to add multiple bits of information, like barcode and format, based on the contents of the selected record.
So, if record XYZ was SELECTED and 10 COPIES needed to be created, there should be 10 fields for barcode and format in the datagrid, while library item is not looped (but is still a field option). I don't know how to go about this and my current try is definitely incorrect. is this even possible or do i need to try looping through a regular form?
here's what I have based on a button_click event which has BindForm() within:
=================================================================
Code:
private void BindForm()
{
addInventryGV.Visible = true;
string binddet = ConfigurationManager.ConnectionStrings["RevisedTapeLibrary"].ConnectionString;
SqlConnection detconn = new SqlConnection(binddet);
SqlCommand dubGridDetDS = new SqlCommand("usp_shwApprovOrLibReqDubDet", detconn);
try
{
dubGridDetDS.Connection.Open();
dubGridDetDS.CommandType = CommandType.StoredProcedure;
int i;
for (i = 0; i < addInventryGV.Rows.Count; i++)
{
Label reqLabel = new Label();
reqLabel = (Label)addInventryGV.Rows[0].Cells[1].FindControl("tpeID");
if (dubberGrid.SelectedRow.Cells[3].Text.ToString() != "NULL")
{
int shwid = Convert.ToInt32(dubberGrid.SelectedRow.Cells[3].Text.ToString());
dubGridDetDS.Parameters.Add("@tapeID", SqlDbType.Int);
dubGridDetDS.Parameters["@tapeID"].Value = shwid;
reqLabel.Text = dubberGrid.SelectedRow.Cells[3].Text.ToString();
}
else if (dubberGrid.SelectedRow.Cells[5].Text.ToString() != "NULL")
{
int vidid = Convert.ToInt32(dubberGrid.SelectedRow.Cells[5].Text.ToString());
dubGridDetDS.Parameters.Add("@tapeID", SqlDbType.Int);
dubGridDetDS.Parameters["@tapeID"].Value = vidid;
reqLabel.Text = dubberGrid.SelectedRow.Cells[5].Text.ToString();
}
else
{
int eleid = Convert.ToInt32(dubberGrid.SelectedRow.Cells[9].Text.ToString());
dubGridDetDS.Parameters.Add("@tapeID", SqlDbType.Int);
dubGridDetDS.Parameters["@tapeID"].Value = eleid;
reqLabel.Text = dubberGrid.SelectedRow.Cells[9].Text.ToString();
}
dubGridDetDS.ExecuteNonQuery();
dubGridDetDS.Connection.Close();
addInventryGV.DataBind();
}
}
catch (SqlException ymu)
{
errorLbl.Text= "Errors<br>" + ymu;
}
}