I tried to follow sample code to perform db update from this thread but none of them work in my case.
That is 1 sample.
1 Code:
Using thiscon As SqlConnection = New SqlConnection(ConfigurationManager.ConnectionStrings("direct_deliveryConnectionString").ConnectionString) thiscon.Open() Dim adapter As New SqlDataAdapter("SELECT pk_ddlvryMasterID,invno FROM tblDDlvryMaster WHERE pk_ddlvryMasterID=" & Me.rowID, thiscon) Dim ds As New DataSet adapter.Fill(ds, "tblDDlvryMaster") With ds.Tables(0).Rows(0) .Item("invno") = invoiceTextBox.Text.ToString End With Dim cb As New SqlCommandBuilder(adapter) adapter.Update(ds, "tblDDlvryMaster") End Using
2.
2 Code:
Using thiscon As SqlConnection = New SqlConnection(ConfigurationManager.ConnectionStrings("direct_deliveryConnectionString").ConnectionString) Using update As SqlCommand = New SqlCommand("update tblDDlvryMaster set invno=@invno where pk_ddlvryMasterID=@ID", thiscon) With update.Parameters .Add("@invno", SqlDbType.VarChar, 30, "invno").Value = invoiceTextBox.Text.ToString .Add("@id", SqlDbType.Int, 10, "pk_ddlvryMasterID").Value = Me.rowID End With thiscon.Open() update.ExecuteNonQuery() End Using End Using
Both sample do not return error or anything and the web form just refresh when I hit update button.
One thing strange more the code dont pause in breakpoints. I added around 3-4 breakpoints but none of them get hit.




Reply With Quote