Silverlight / WPF - Call and Run a TableAdapter query on a form

Asked By David on 08-Jan-12 04:05 PM
Earn up to 20 extra points for answering this tough question.
Hi All I am still trying to solve this call and run query after 2 years can anyone help

Private Sub BindingNavigatorAddNewItem_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BindingNavigatorAddNewItem.Click

Dim dt As DataTable = New DataTable()

Dim connString As String = ConfigurationManager.ConnectionStrings("WpfDataEntry.MySettings.VB_DAVE_1__mainConnectionString").ConnectionString

Dim query As String = "SELECT COURSEName&Prikey3&Date&H1PAR&H2PAR&H3PAR&H4PAR, H5PAR, H6PAR, H7PAR, H8PAR, H9PAR, H10PAR, H11PAR, H12PAR, H13PAR, H14PAR, H15PAR, H16PAR, H17PAR, H18PAR, H1SC, H2SC, H3SC, H4SC, H5SC, H6SC, H7SC, H8SC, H9SC, H10SC, H11SC, H12SC, H13SC, H14SC, H15SC, H16SC,H17SC, H18SC, H1TEE, H2TEE, H3TEE, H4TEE, H5TEE, H6TEE, H7TEE, H8TEE, H9TEE, H10TEE, H11TEE, H12TEE, H13TEE, H14TEE, H15TEE, H16TEE, H17TEE, H18TEE, H1FWAY, H2FWAY, H3FWAY, H4FWAY, H5FWAY, H6FWAY, H7FWAY, H8FWAY, H9FWAY, H10FWAY, H11FWAY, H12FWAY, H13FWAY, H14FWAY, H15FWAY, H16FWAY, H17FWAY, H18FWAY, BUNK1, BUNK2, BUNK3, BUNK4, BUNK5, BUNK6, BUNK7, BUNK8, BUNK9, BUNK10, BUNK11, BUNK12, BUNK13, BUNK14, BUNK15, BUNK16, BUNK17, BUNK18, PUTT1, PUTT2, PUTT3, PUTT4, PUTT5, PUTT6, PUTT7, PUTT8, PUTT9, PUTT10, PUTT11, PUTT12, PUTT13, PUTT14, PUTT15, PUTT16, PUTT17, PUTT18, GR1, GR2, GR3, GR4, GR5, GR6, GR7, GR8, GR9, GR10, GR11, GR12, GR13, GR14, GR15, GR16, GR17, GR18, BUNK1OUT, BUNK2OUT, BUNK3OUT, BUNK4OUT, BUNK5OUT, BUNK6OUT, BUNK7OUT, BUNK8OUT, BUNK9OUT, BUNK10OUT, BUNK11OUT, BUNK12OUT, BUNK13OUT, BUNK14OUT, BUNK15OUT, BUNK16OUT, BUNK17OUT, BUNK18OUT, H1YDS, H2YDS, H3YDS, H4YDS, H5YDS, H6YDS, H7YDS, H8YDS, H9YDS, H10YDS, H11YDS, H12YDS, H13YDS, H14YDS, H15YDS, H16YDS, H17YDS, H18YDS FROM COURSE WHERE (Primarykey =" + "FROM [COURSE]"

'What do I need to make this run a Tableadapter insert command query?

' Data base is Access 2007 this programme is visual studio 2008.


Me.taManager.UpdateAll(Me.CoursesPlayedDataSet)

CoursesPlayedDataSet.AcceptChanges()


Dim newWindow12 = New Window12

Me.Close()

Dim newWindow3 = New Window3

newWindow3.Show()

End Sub

[)ia6l0 iii replied to David on 08-Jan-12 11:04 PM
You are doing a select in your query, and you are expecting Update? Sorry, your question wasn't clear.

But one thing that your code snippet really says is that you want to use TableAdapterManager.UpdateAll() method to do a hierarchical update instead of calling TableAdapterManager.Update methods individually.

And note  that for this to work, you need to set the HierarchicalUpdate property to true in the dataset designer.
kalpana aparnathi replied to David on 09-Jan-12 03:38 AM
hi,

it's not clear if you need this to be done in the client tier

would it not be possible to just do this in a simple sql statement or stored proc, if all the gui is doing is showing whats in the dbms


then would be something like this example:


SELECT t1.field1, etc etc

INTO table2 t2
FROM tabel1 t1
where t1.field1 = etc etc

Thanks
David replied to [)ia6l0 iii on 10-Jan-12 03:52 PM
Hi all sorry I cant make it work and dont understand at all
There must be a simple way which I should be able to do

David
David replied to kalpana aparnathi on 16-Jan-12 04:09 PM
Sorry duplicated reply

David