Monaglit
asked on
uploading xml to database vb.net
URGENT !!
Can someone give me the vb.net code to upload xml file to sql server. very urgent.thanks.
Can someone give me the vb.net code to upload xml file to sql server. very urgent.thanks.
ASKER
I am selecting the XML file from hard disk. in that case what will xmldata be?
ASKER
when i run this i get column name or number of supplied values does not match
ASKER
i need to put the element values as the column values in the database
I am selecting the XML file from hard disk. in that case what will xmldata be?You can use the XmlDocument.Load method to read a file from disk:
Dim xmlData As New XmlDocument()
xmlData.Load("C:\path\to\file.xml")
i need to put the element values as the column values in the database
Oh. I got the impression from your question that you were inserting the actual XML into the database. If you need to insert the node values into specific columns, then we would need to see the XML structure and the database column names.
ASKER
here is the sample xml and table columns
<Records filename="C:\Documents and Settings\Data.csv">
<Record RowID="1">
<EmployeeID>D091</Employee ID>
<Name>hhh</Name>
<surname>sss</surname>
<DateofBirth>2004-4-12 00:00</DateofBirth>
</Record>
<Record RowID="2">
<EmployeeID>C002</Employee ID>
<Name>sjjj</Name>
<surname>kkkk</surname>
<DateofBirth>
</DateofBirth>
</Record>
</Records>
TableName - Employee
columns -
Employee_ID varchar(20)
Name varchar(20)
Surname varchar(50)
DateofBirth datetime
<Records filename="C:\Documents and Settings\Data.csv">
<Record RowID="1">
<EmployeeID>D091</Employee
<Name>hhh</Name>
<surname>sss</surname>
<DateofBirth>2004-4-12 00:00</DateofBirth>
</Record>
<Record RowID="2">
<EmployeeID>C002</Employee
<Name>sjjj</Name>
<surname>kkkk</surname>
<DateofBirth>
</DateofBirth>
</Record>
</Records>
TableName - Employee
columns -
Employee_ID varchar(20)
Name varchar(20)
Surname varchar(50)
DateofBirth datetime
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks. Already managed to do. But will accept this as the solution.
ASKER
good upload script.
Open in new window