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>
Edson FernandesAsked:
Who is Participating?
 
Aneesh RetnakaranDatabase AdministratorCommented:
The following link will help you how to call a stored procedure

http://csharp-station.com/Tutorial/AdoDotNet/Lesson07

its the best practice to create all the database objects separately thru a sql script, this includes creating the databases tables indexes and stored procedures.
1
 
Aneesh RetnakaranDatabase AdministratorCommented:
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.
0
 
Edson FernandesAuthor Commented:
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?
0
 
_agx_Commented:
(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
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.