How can I use the same data to update many tables

G

Guest

Private Sub btnSaveAndClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSaveAndClose.Clic
In one point in my application I allow the user to select some text - say Yom Kippur War - and then click the QuickWord button. That opens up a frmQuickWord. On it appears a single textbox with the word selected

QuickWord was meant to create a new Keyword Set. The selected text in this case will be the Keyword Set, the Keyword and the Search Phrase. In cases where there'll more 2 or more keywords and search phrases(Yom Kippur War, Yom Kipper War, October War), the user will click a different button

I realized at once that my problem in the following code is that I haven't bound the textbox to the data. If I have to bind a textbox and a checkbox then it seems I'll need a second textbox for the autoincremental ID field. What I'm afraid of is that I'll have to rebind them in the code for the Keyword, SearchPhrase, and KeywordSetAssignments tables. This would be very wordy, and I have a number of forms of this nature to finish. Is there a simpler way

Sorry for the slight incoherence. I'm quite handicapped and quite ill, with a high fever. Nevertheless, I want to get this project done, before I expire. Don't have so much more to do

dennis


Tr
MsgBox(cnQWKS.DataSource.ToString

cnQWKS.Open(
Dim iKSModified = daQWKS.Update(DsQWKS1, "KeywordSets"
Dim strOutput As Strin
strOutput = "Modified " & iKSModified & " KeywordSet(s)
MessageBox.Show(strOutput, "Update succeeded!", MessageBoxButtons.OK, MessageBoxIcon.Information
daQWK.Update(DsQWKS1, "Keywords"
daQWSP.Update(DsQWKS1, "SearchPhrase"
daQWSP.Update(DsQWKS1, "KeywordSetAssignments"
Catch ex As Exceptio
MessageBox.Show("Type = " & ex.GetType.ToString & vbCr & "Message = " & ex.Message
End Tr
cnQWKS.Close(
Me.Close(
End Sub
 
W

William Ryan

Dennist:
<<I realized at once that my problem in the following code is that I haven't
bound the textbox to the data. If I have to bind a textbox and a checkbox
then it seems I'll need a second textbox for the autoincremental ID field.
What I'm afraid of is that I'll have to rebind them in the code for the
Keyword, SearchPhrase, and KeywordSetAssignments tables. This would be very
wordy, and I have a number of forms of this nature to finish. Is there a
simpler way?>>

Why is it that you'd need to bind the autoincrement field? You can set your
datatable so the autoincrement property of that field is set to true, then
set the increment value to -1. When the update is submitted, the DB will
take care of inserting /assigning the correct values. But even if you don't
do this, binding a textbox to the field isn't going to do anything in an of
itself.

And if I understand correctly, there shouldn't be any additional binding
once the core functionality is in place. You'll just need to filter the
data using things like the DataTable.Select or DataView.RowFilter etc.

HTH,

Bill
dennist said:
Private Sub btnSaveAndClose_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles btnSaveAndClose.Click
In one point in my application I allow the user to select some text - say
Yom Kippur War - and then click the QuickWord button. That opens up a
frmQuickWord. On it appears a single textbox with the word selected.
QuickWord was meant to create a new Keyword Set. The selected text in
this case will be the Keyword Set, the Keyword and the Search Phrase. In
cases where there'll more 2 or more keywords and search phrases(Yom Kippur
War, Yom Kipper War, October War), the user will click a different button.
I realized at once that my problem in the following code is that I haven't
bound the textbox to the data. If I have to bind a textbox and a checkbox
then it seems I'll need a second textbox for the autoincremental ID field.
What I'm afraid of is that I'll have to rebind them in the code for the
Keyword, SearchPhrase, and KeywordSetAssignments tables. This would be very
wordy, and I have a number of forms of this nature to finish. Is there a
simpler way?
Sorry for the slight incoherence. I'm quite handicapped and quite ill,
with a high fever. Nevertheless, I want to get this project done, before I
expire. Don't have so much more to do.
dennist



Try
MsgBox(cnQWKS.DataSource.ToString)

cnQWKS.Open()
Dim iKSModified = daQWKS.Update(DsQWKS1, "KeywordSets")
Dim strOutput As String
strOutput = "Modified " & iKSModified & " KeywordSet(s)"
MessageBox.Show(strOutput, "Update succeeded!",
MessageBoxButtons.OK, MessageBoxIcon.Information)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top