Skip to main content

How to pass datatable as in parameter to stored procedure


This is one of the issue I came across while developing a window service for updating data in bulk. But this was developed with the complete support my friends and all the credits goes to them ;).

Stored Procedure

CREATE PROCEDURE MySP      
 @TypeDataTable AS [MyType] READONLY        
AS                    
BEGIN
//Your logic
END


User defined Type 
CREATE TYPE MyType AS TABLE(
          [Column] [DataType] NULL/NOT NULL,
          ...
)

From code call the same we usually call the stored procs by passing the DataTable object as paramater.

Comments

Popular posts from this blog

Creating multi module project with maven

Creating my first multi module project with maven I got a superb step by step article for maven project creation in eclipse while googling. This article is good for beginners like me :) , no need do too many things, just follow the steps at the end you will see “Hello World” in the browser. Check the below link for the wonderful article. http://skillshared.blogspot.in/2012/11/how-to-create-multi-module-project-with.html Thanks Semika Loku Kaluge

Unable to convert MySQL date/time value to System.DateTime - Solved

Few days back I got an exception like 'Unable to convert Mysql date/time value to system.datetime' but this happened only after deploying and locally everything was working fine. After googling for sometimes found the reason that, it was due to the formatting difference between Mysql and C# also empty date value is causing some issue. Later found the below solution to fix'em. Add an extra property(Convert Zero Datetime = true) to connectino string. e.g server=localhost;User Id=root;password=pwd;database=test; Convert Zero Datetime=true Solution obtained from StackOverflow :)

Converting String to a Executable line in JAVA

I've been searching for converting a string into a executable line so that I could process it... after searching for sometime, as usual I got a solution in the name of BeanShell scripting awesome one... This is another scripting language built with Java, which is powerful and was able to solve my need... This is the link for it : http://www.beanshell.org/manual/bshmanual.html#Download_and_Run_BeanShell Hope this helps you as well... If anyone requires any help on this, a basic one ;) ... sure post a comment, will help if I could...