G
ggoldab
Hi,
Here is my code on a button click in the EmptyDataTemplate of a
Gridview. It saves the record to the database does not appear in the
gridview after the calling the databind method.
Any ideas ?
Below is my code
Protected Sub lnkSaveEmpty_Click(ByVal sender As Object, ByVal e
As System.EventArgs)
'save empty data
'retriev the description
Dim lnkSaveEmpty As LinkButton = sender
Dim row As GridViewRow =
DirectCast(lnkSaveEmpty.NamingContainer, GridViewRow)
Dim dpItemNo_Empty As DropDownList =
CType(row.FindControl("dpItemNo_Empty"), DropDownList)
Dim strSQL As String, cmd As OleDbCommand, dr As
OleDbDataReader
Dim objConnection As OleDbConnection
objConnection = New
OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;data source=" &
Server.MapPath("~\app_data\print_manager.mdb"))
objConnection.Open() 'open the connection
'strSQL = "Update tbl_job_details SET job_id = " &
FormView1.DataKey(0) & ", card_id= " & dpItemNo_Empty.SelectedValue &
",qty=300 "
strSQL = "Insert INTO tbl_job_details (job_id,card_id,qty)
VALUES ( " & FormView1.DataKey(0) & "," & dpItemNo_Empty.SelectedValue
& ",300)"
cmd = New OleDbCommand(strSQL, objConnection)
cmd.ExecuteNonQuery()
GridView1.DataBind()
End Sub
Thanks
Geoff
Here is my code on a button click in the EmptyDataTemplate of a
Gridview. It saves the record to the database does not appear in the
gridview after the calling the databind method.
Any ideas ?
Below is my code
Protected Sub lnkSaveEmpty_Click(ByVal sender As Object, ByVal e
As System.EventArgs)
'save empty data
'retriev the description
Dim lnkSaveEmpty As LinkButton = sender
Dim row As GridViewRow =
DirectCast(lnkSaveEmpty.NamingContainer, GridViewRow)
Dim dpItemNo_Empty As DropDownList =
CType(row.FindControl("dpItemNo_Empty"), DropDownList)
Dim strSQL As String, cmd As OleDbCommand, dr As
OleDbDataReader
Dim objConnection As OleDbConnection
objConnection = New
OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;data source=" &
Server.MapPath("~\app_data\print_manager.mdb"))
objConnection.Open() 'open the connection
'strSQL = "Update tbl_job_details SET job_id = " &
FormView1.DataKey(0) & ", card_id= " & dpItemNo_Empty.SelectedValue &
",qty=300 "
strSQL = "Insert INTO tbl_job_details (job_id,card_id,qty)
VALUES ( " & FormView1.DataKey(0) & "," & dpItemNo_Empty.SelectedValue
& ",300)"
cmd = New OleDbCommand(strSQL, objConnection)
cmd.ExecuteNonQuery()
GridView1.DataBind()
End Sub
Thanks
Geoff