I trying to get data from webform into a datagrid so that as users enter data they can see what they have entered so far. So far, as the user enters data and click the submit button that data is enter into the datagrid, but when they enter data again and click submit the previous data is overwritten. How do i append data to the grid that already has data entered. Thanks, Here is my code:
Also here is my code for the billcal class
Any help would be appreciated
Thanks,
Blake
VB.NET:
Dim cmdRAP3 As OleDb.OleDbCommand
Dim strSQL AsString
Dim array AsNew ArrayList
PrivateSub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) HandlesMyBase.Load
'Put user code to initialize the page here
lblpcnnumber.Text = Session("PCN").ToString()
' array.Add(New billcal("4444", "444433", "sn", "66"))
dgprogress.DataSource = array
EndSub
PrivateSub btnsubmit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnsubmit.Click
array.Add(New billcal(lblpcnnumber.Text, cal.SelectedDate, ddlskills.SelectedValue, txtunits.Text))
'printtodatagrid()
strSQL = "INSERT INTO Table3(pcn, [date], skill, unit) VALUES ('" & lblpcnnumber.Text & _
"', '" & cal.SelectedDate & "', '" & ddlskills.SelectedValue & _
"', '" & txtunits.Text & "')"
ExecuteDBCommand(strSQL)
' array.Add(lblpcnnumber.Text)
' array.Add(cal.SelectedDate)
'array.Add(ddlskills.SelectedValue)
'array.Add(txtunits.Text)
lblerror.Text = array.Count
dgprogress.DataBind()
EndSub
PrivateSub ExecuteDBCommand(ByVal strVal AsString)
' lblerrormessage.Text() = cmdRAP3.Connection.State()
Try
cmdRAP3 = New OleDb.OleDbCommand(strVal, conRAP3)
With cmdRAP3
.Connection = conRAP3
.CommandType = CommandType.Text
.CommandText = strVal
.Connection.Open()
.ExecuteNonQuery()
EndWith
Catch ex As Exception
lblerrormessage.Text = ex.Message
With cmdRAP3.Connection
If .State = ConnectionState.Open Then
.Close()
EndIf
EndWith
EndTry
EndSub
PublicSub printtodatagrid()
EndSub
Also here is my code for the billcal class
VB.NET:
PublicClass billcal
Private p_pcn AsString
Private p_date AsString
Private p_skill AsString
Private p_unit AsString
PublicSubNew(ByRef pcn, ByRef [date], ByRef skill, ByRef unit)
p_pcn = pcn
p_date = [date]
p_skill = skill
p_unit = unit
EndSub
PublicProperty pcn() AsString
Get
Return p_pcn
EndGet
Set(ByVal Value AsString)
p_pcn = Value
EndSet
EndProperty
PublicProperty [date]() AsString
Get
Return p_date
EndGet
Set(ByVal Value AsString)
p_date = Value
EndSet
EndProperty
PublicProperty skill() AsString
Get
Return p_skill
EndGet
Set(ByVal Value AsString)
p_skill = Value
EndSet
EndProperty
PublicProperty unit() AsString
Get
Return p_unit
EndGet
Set(ByVal Value AsString)
p_unit = Value
EndSet
EndProperty
EndClass
Any help would be appreciated
Thanks,
Blake