crussell96
New member
- Joined
- Jul 18, 2005
- Messages
- 1
- Programming Experience
- Beginner
Hello, here is what I am doing.
I have a datagrid named dgClassStartDates with 2 colums displayed
Description and date. When the user clicks the 'Save' button it
executes a stored procedure that accepts 3 parameters. 2 come from the
columns datagrid and the third is a variable. The code for attaching
and giving the values to the parameters is below. Now I can get it to
work fine with only 1 row in the datagrid but exactly what steps do I
need to take if there are multiple rows in the datagrid. Someone suggested looping through all rows in the datagrid but I cant seem to get that to work.
'Attach Parameters
cmdClassPeriodStartDatesAddNew.Parameters.Add(prmStartDescription)
cmdClassPeriodStartDatesAddNew.Parameters.Add(prmStartDate)
cmdClassPeriodStartDatesAddNew.Parameters.Add(prmCaseID)
'Give Parameters values
prmStartDescription.Value =
frmCaseKeyDatesOpen.dgClassStartDates.Item(0, 0)
prmStartDate.Value = frmCaseKeyDatesOpen.dgClassStartDates.Item(0, 1)
prmCaseID.Value = globalCaseID 'This is a variable
'Execute command
cmdClassPeriodStartDatesAddNew.ExecuteNonQuery()
I have a datagrid named dgClassStartDates with 2 colums displayed
Description and date. When the user clicks the 'Save' button it
executes a stored procedure that accepts 3 parameters. 2 come from the
columns datagrid and the third is a variable. The code for attaching
and giving the values to the parameters is below. Now I can get it to
work fine with only 1 row in the datagrid but exactly what steps do I
need to take if there are multiple rows in the datagrid. Someone suggested looping through all rows in the datagrid but I cant seem to get that to work.
'Attach Parameters
cmdClassPeriodStartDatesAddNew.Parameters.Add(prmStartDescription)
cmdClassPeriodStartDatesAddNew.Parameters.Add(prmStartDate)
cmdClassPeriodStartDatesAddNew.Parameters.Add(prmCaseID)
'Give Parameters values
prmStartDescription.Value =
frmCaseKeyDatesOpen.dgClassStartDates.Item(0, 0)
prmStartDate.Value = frmCaseKeyDatesOpen.dgClassStartDates.Item(0, 1)
prmCaseID.Value = globalCaseID 'This is a variable
'Execute command
cmdClassPeriodStartDatesAddNew.ExecuteNonQuery()