Link to home
Start Free TrialLog in
Avatar of Edson Fernandes
Edson Fernandes

asked on

How do I create a table in sql server using c# and xml?

I would like to create a persons table in sql server using c # with the xml file below.  The fields in the persons table need be   person_id, type and oneof.  How do I code this in c#.
 Am new to programming.

<?xml version="1.0" encoding="UTF-8"?>

-<root type="array">


-<persons>

<person_id>_:genid1</person_id>

<type>http://www.w3.org/2000/01/rdf-schema#Datatype</type>


-<oneofs>

<oneof>A|ASSUMED FRIEND|D|NONE SPECIFIED|F|FRIEND|H|HOSTILE|J|JOKER (Exercise Only - acting as a suspect)</oneof>

</oneofs>

</persons>


-<persons>

<person_id>_:genid108</person_id>

<type>http://www.w3.org/2000/01/rdf-schema#Datatype</type>


-<oneofs>

<oneof>Air Mission|Air Mission|Counter-Insurgency|Counter-Insurgencyt</oneof>

</oneofs>

</persons>
</root>
Avatar of Aneesh
Aneesh
Flag of Canada image

Why cant you create the table in sql server first ? In most of the cases, the database user thru which the application connects to the database wont have sufficient permissions to create the tables.
Avatar of Edson Fernandes
Edson Fernandes

ASKER

I can create the database & table prior Agreed. I still need to create a stored procedure in sql server and then call that stored procedure in c#./
How do I do that?
ASKER CERTIFIED SOLUTION
Avatar of Aneesh
Aneesh
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
(No points...)

Agreed.  For database design, use an IDE like SQL Server Management Studio for creating tables, procedures, etc... Then you can invoke the stored procedures from C#.

https://docs.microsoft.com/en-us/sql/ssms/download-sql-server-management-studio-ssms
https://technet.microsoft.com/en-us/library/ms365247(v=sql.105).aspx