Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Win Form and SQL 2000 Server (Update) *VERY IMPORTANT*

Status
Not open for further replies.

Domino2006

Programmer
Jan 13, 2007
20
0
0
GB
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
 
I'm not real familiar with all of the features of data binding (we use a custom DAL here) but can't you specify the stored procs to be used for basic Update/Insert/Delete commands with a SQLServer datatable?

If so, and if your XML data is in the same structure as your SQLServer's data, you should be able to open a datatable for both your SQLServer table and the XML table and use datatable.importrow(dstXML.table("TableName").rows(Rownumber)) to pull the data across.

-Rick

VB.Net Forum forum796 forum855 ASP.NET Forum
[monkey]I believe in killer coding ninja monkeys.[monkey]
 
I understand what your saying but im useing VB.net 2005 and the way its been structured is a design laid out by our client , so i have to follow protocol. thanks for the post :)
 
I understand what your saying but im useing VB.net 2005 and the way its been structured is a design laid out by our client , so i have to follow protocol. thanks for the post :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top