Domino2006
Programmer
Hi Guys this as a requested update from my last post.
Ok here goes. I have a form with "3" datasets im reading an xml schema from a file in a driectory into 1 of the data sets That has 26 tables, what im trying to do is insert all the data from the xml file into an sql database but after i have read all the data into my HINVDATAdataset in my app first.,
for example the "Me.AiringcupboardTableAdapter.Insert" command isnt working please help this is a serious project and my job depends on it. if you can help please post code aswell.
thanks in advance.
ps. the xml.shema.read is working its the insert command that usnt working am i missing something obvious????
""code below""
Public Sub logchange(ByVal source As Object, ByVal e As _
System.IO.FileSystemEventArgs)
If e.ChangeType = IO.WatcherChangeTypes.Created Then
MessageBox.Show("Inventory " & e.FullPath & _
" has Arrived" & vbCrLf)
End If
HINVDATADataSet.ReadXml("C:\Test\Inventory.xml", Data.XmlReadMode.ReadSchema)
Dim i As Int32
Dim cn As New SqlConnection("Data Source=SERVER1\HAMILTONGROUP;Initial Catalog=HINVDATA;Persist Security Info=True;User ID=sa;Password=********")
Dim cmd As New SqlCommand("select count(*) from AiringCupboard where inventoryid = @inventoryid", cn)
cn.Open()
Try
cmd.Parameters.Add("@inventoryid")
i = cmd.ExecuteScalar
Catch ex As Exception
MsgBox(ex.Message)
Finally
cn.Close()
End Try
If i = 0 Then
Try
Me.AiringcupboardTableAdapter.Insert(pID, doortype1.Text, doorcolor1.Text, doorcond1.Text, doorcomments.Text, wintype1.Text, wincolor1.Text, wincond1.Text, wincomments.Text, floortype1.Text, floorcolor1.Text, floorcond1.Text, floorcomments.Text, decwtype1.Text, decwcolor1.Text, decwcond1.Text, decwallcomments.Text, decctype1.Text, decccolor1.Text, decccond1.Text, decceilingcomments.Text, dadotype1.Text, dadocolor1.Text, dadocond1.Text, dadocomments.Text, skirttype1.Text, skirtcolor1.Text, skirtcond1.Text, skirtcomments.Text, lightceiling1.Text, lightquantity1.SelectedItem, lightcond1.Text, lightceilcomments.Text, lightwall1.Text, lightwallquantity1.SelectedItem, lightwallcond1.Text, lightwallcomments.Text, lampstype1.Text, lampsquantity1.SelectedItem, lampscond1.Text, lampscomments.Text, heattype2.Text, heatquantity2.SelectedItem, heatcond2.Text, heatingcomments.Text)
MsgBox(" Save Complete")
Catch ex As Exception
MsgBox(ex.Message)
End Try
End If
Ok here goes. I have a form with "3" datasets im reading an xml schema from a file in a driectory into 1 of the data sets That has 26 tables, what im trying to do is insert all the data from the xml file into an sql database but after i have read all the data into my HINVDATAdataset in my app first.,
for example the "Me.AiringcupboardTableAdapter.Insert" command isnt working please help this is a serious project and my job depends on it. if you can help please post code aswell.
thanks in advance.
ps. the xml.shema.read is working its the insert command that usnt working am i missing something obvious????
""code below""
Public Sub logchange(ByVal source As Object, ByVal e As _
System.IO.FileSystemEventArgs)
If e.ChangeType = IO.WatcherChangeTypes.Created Then
MessageBox.Show("Inventory " & e.FullPath & _
" has Arrived" & vbCrLf)
End If
HINVDATADataSet.ReadXml("C:\Test\Inventory.xml", Data.XmlReadMode.ReadSchema)
Dim i As Int32
Dim cn As New SqlConnection("Data Source=SERVER1\HAMILTONGROUP;Initial Catalog=HINVDATA;Persist Security Info=True;User ID=sa;Password=********")
Dim cmd As New SqlCommand("select count(*) from AiringCupboard where inventoryid = @inventoryid", cn)
cn.Open()
Try
cmd.Parameters.Add("@inventoryid")
i = cmd.ExecuteScalar
Catch ex As Exception
MsgBox(ex.Message)
Finally
cn.Close()
End Try
If i = 0 Then
Try
Me.AiringcupboardTableAdapter.Insert(pID, doortype1.Text, doorcolor1.Text, doorcond1.Text, doorcomments.Text, wintype1.Text, wincolor1.Text, wincond1.Text, wincomments.Text, floortype1.Text, floorcolor1.Text, floorcond1.Text, floorcomments.Text, decwtype1.Text, decwcolor1.Text, decwcond1.Text, decwallcomments.Text, decctype1.Text, decccolor1.Text, decccond1.Text, decceilingcomments.Text, dadotype1.Text, dadocolor1.Text, dadocond1.Text, dadocomments.Text, skirttype1.Text, skirtcolor1.Text, skirtcond1.Text, skirtcomments.Text, lightceiling1.Text, lightquantity1.SelectedItem, lightcond1.Text, lightceilcomments.Text, lightwall1.Text, lightwallquantity1.SelectedItem, lightwallcond1.Text, lightwallcomments.Text, lampstype1.Text, lampsquantity1.SelectedItem, lampscond1.Text, lampscomments.Text, heattype2.Text, heatquantity2.SelectedItem, heatcond2.Text, heatingcomments.Text)
MsgBox(" Save Complete")
Catch ex As Exception
MsgBox(ex.Message)
End Try
End If