Monday, October 25, 2010

Sending multiple rows to the Database from an Application in XML Format

If the XML data is in the form 






then the pass the  xml data to the stored procedure and the procedure will parse the xml and inserts the data into the database as written below in the stored procedure.


Create a table called Employee Having the following fields.
employeeId(int),Name(varchar(50)),salary(money),
designation(varchar(50)),department(varchar(50)) and 


write the procedure as below.



Create Procedure InsertData
(
@xml XML
)
as
BEGIN
Insert INTO Employee(employeeId,Name,salary,designation,department)
SELECT T.Item.value('@EmployeeId', 'Int') EmployeeId,
  T.Item.value('@Name', 'VARCHAR(50)') Name,   T.Item.value('@salary', 'Money') salary,   T.Item.value('@designation', 'VARCHAR(50)') designation,   T.Item.value('@department', 'VArchar(50)') department  
 FROM @xml.nodes('/ROWS/ROW') AS T(Item)
END



This will parse the XML Data passed and will insert the values into the database.


Please refer to the following link.





http://www.sqlservercentral.com/articles/T-SQL/67603/

Thursday, October 21, 2010

How to assign strong name to an external DLL

Open Visual Studio command prompt.
For this you must have a strong name key file(.snk file)


ildasm dllname.dll /OUT=dllname.il
ilasm /DLL dllname.il /KEY=keyname.snk

How to use the command prompt to open a Remote Desktop Connection(RDP)

Please use the following command for opening the remote desktop in command prompt.
mstsc /admin /v:ServerName