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</perso n_id>
<type>http://www.w3.org/2000/01/rdf-schema#Datatype</type>
-<oneofs>
<oneof>A|ASSUMED FRIEND|D|NONE SPECIFIED|F|FRIEND|H|HOSTI LE|J|JOKER (Exercise Only - acting as a suspect)</oneof>
</oneofs>
</persons>
-<persons>
<person_id>_:genid108</per son_id>
<type>http://www.w3.org/2000/01/rdf-schema#Datatype</type>
-<oneofs>
<oneof>Air Mission|Air Mission|Counter-Insurgency |Counter-I nsurgencyt </oneof>
</oneofs>
</persons>
</root>
Am new to programming.
<?xml version="1.0" encoding="UTF-8"?>
-<root type="array">
-<persons>
<person_id>_:genid1</perso
<type>http://www.w3.org/2000/01/rdf-schema#Datatype</type>
-<oneofs>
<oneof>A|ASSUMED FRIEND|D|NONE SPECIFIED|F|FRIEND|H|HOSTI
</oneofs>
</persons>
-<persons>
<person_id>_:genid108</per
<type>http://www.w3.org/2000/01/rdf-schema#Datatype</type>
-<oneofs>
<oneof>Air Mission|Air Mission|Counter-Insurgency
</oneofs>
</persons>
</root>
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.
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?
How do I do that?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
(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
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