Click here to Skip to main content
Sign Up to vote bad
good
See more: C#.NETMySQL
Hi All,
 
Please help me.
I need to pass a DataSet in MySQL.
 
It is feasible in MSSQL since I already tried it.
 
I do it like this in MSSQL:
In my c# code:
DataSet ds = new DataSet("Uploads");
ds.Tables.Add(new DataTable("exclution"));
SqlCommand oCommand = new SqlCommand("spUpdateDatabase", oConnection);
oCommand.CommandType = CommandType.StoredProcedure;
oCommand.Parameters.AddWithValue("@LocalDatabase", ds.GetXml());
And my stored procedure would be like this:
DECLARE @index int
    
BEGIN TRANSACTION
 
EXEC sp_xml_preparedocument @index OUTPUT, @LocalDatabase
 
        INSERT INTO		        exclution
	SELECT			        @BranchCode
				,	ExclutionID
				,	InsuredID
				,	InsuredRelationship
				,	ExclutionDiagnoses
	FROM	OPENXML(@index, 'Uploads/exclution')
	WITH	(	ExclutionID          int         'ExclutionID'
		  ,	InsuredID            int         'InsuredID'
		  ,	InsuredRelationship  varchar(45) 'InsuredRelationship'
		  ,	ExclutionDiagnoses   varchar(100)'ExclutionDiagnoses')
 
EXEC sp_xml_removedocument @index  
     
IF (@@ERROR <> 0)
BEGIN
	ROLLBACK TRANSACTION
	SELECT 1
END
ELSE
BEGIN
	COMMIT TRANSACTION
	SELECT 0
END
 
But I cant find a way to do it in MySQL.
Any help would be greatly appreciated.
 
Thanks in advance.
Posted 15 Aug '11 - 22:25
Edited 18 Aug '11 - 22:51

Comments
unknowndentified10111 - 19 Aug '11 - 4:51
No one is answering... :(
Simon_Whale - 19 Aug '11 - 5:14
For me personally I can't see a way to implement what you are asking for in the same manner as SQL Server does. I think you may have to change your approach. maybe someone else has a different idea for you

1 solution

The MySQL Documentation might be a good place to start
 
MySQL XML functions[^]
  Permalink  
Comments
unknowndentified10111 - 16 Aug '11 - 5:02
I already looked into that. But the xml function of MySql can't return a Table Set. It only return a scalar value. What I need is like what I do in my MSSQL stored procedure. But thanks anyways..
Simon_Whale - 16 Aug '11 - 5:08
dont know if this will help? http://www.lampdev.net/programming/mysql/mysql-stored-procedure-in-parameter-array-data.html as I dont know how big your dataset that you want to pass in, someone here has found a way to pass in a parameter array
unknowndentified10111 - 16 Aug '11 - 20:18
That would'nt work for me, the parameter array was only always a single dimension array, If I'm going to pass a dataset, I atleast need a two dimension array for rows and columns. Thanks for the reply. But I still need help.....

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 Sergey Alexandrovich Kryukov 358
1 OriginalGriff 355
2 Arun Vasu 345
3 Maciej Los 208
4 Zoltán Zörgő 189
0 Sergey Alexandrovich Kryukov 9,755
1 OriginalGriff 7,559
2 CPallini 4,018
3 Rohan Leuva 3,362
4 Maciej Los 2,951


Advertise | Privacy | Mobile
Web01 | 2.6.130523.1 | Last Updated 19 Aug 2011
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid