Inserting all rows of a datatable into Oracle Table in a single shot, not row by row using C#

Hi All...

I have imported the data of CSV File into Datable using C#. Now i need to insert the content of DataTable to the table in Oracle Database in a single shot, without looping through the rows of the datatable.

Is this Possible?

Please help me out by providing the sample code.

Below is sample code for Importing the CSV Data to Dataset

string connString =string.Format("Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};Extended Properties=Text;",Path.GetDirectoryName(filename));

string cmdString =string.Format("SELECT * FROM {0}", Path.GetFileName(filename));

DataSet dataset = new DataSet();using (OleDbConnection conn = new OleDbConnection(connString))

{

conn.Open();

OleDbDataAdapter adapter = new OleDbDataAdapter();

adapter.SelectCommand = new OleDbCommand(cmdString, conn);

adapter.Fill(dataset, "TEST");

conn.Close();

}

 

Thanks,

Cute.

 


Thanks,
Cute
0
cutekids525
4/29/2009 9:26:58 AM
asp.net.oracle 2269 articles. 0 followers. Follow

1 Replies
2851 Views

Similar Articles

[PageSpeed] 16

refer:

http://forums.asp.net/t/1312239.aspx

http://forums.asp.net/t/1323280.aspx


SSN
Please remember to click "Mark as Answer" on the post that helps you.
0
suthish
4/29/2009 11:33:54 AM
Reply:

Similar Artilces:

Is having a trigger that inserts a row in Table 'A', when a row in same table is inserted by ADo.Net code?
I want to insert a row for a Global user  in Table 'A' whenever ADO.Net code inserts a Local user row into same table. I recommended using a trigger to implement this functionality, but the DBA was against it, saying that stored proecedures should be used, since triggers are unreliable and slow down the system by placing unecessary locks on the table. Is this true OR the DBA is saying something wrong? My thinking is that Microsoft will never include triggers if they are unreliable and the DBA is just wanting to offload the extra DBA task of triggers to the programmer so that a s...

Get the last inserted row's Identity (ID) using DataTable and Row
 hiI use DataTable and Row and the Update() method to insert data into my table.I need to retrieve the Identity (ID) assigned to that row for further processing. (e.g. add data into other tables that refer to this row).How do I retrieve the ID?  In a high traffic website (e.g. 100 inserts in 5 seconds), by just retrieving the ID of the last inserted row may not be very safe. Please advise if I am correct.Any other methods of achieving the same goal?thanks in advance  string query = "Insert Into yourTableName("col1","col2") values(xyz,pqr) select...

HTML table row
Hi, I am using asp.net 3.5.Below is the code from markup area, my requirement is - I placed 2 options buttons on the page. when user click on first button the first row should be (2nd row shoud be hidden here)visible, if select 2nd button the 2nd row should be visible in the same place as the first row (1st row shoud be hidden here)- something similar we do in windows programming,IS POSSIBLE<asp:TableRow ID="TableRow34" Height=30 runat="server" style="font-size:11px;color:#0033FF"> <asp:TableCell ID="TableCell74" columnSpan=4 HorizontalAlign =...

I want to select top 3 rows except the first from 4 rows of a Table. It should select from top 2 row,top3 row and top4 row.
 Hi, Let say I've 4 rows in a table. I want to select top 3 rows except the first from 4 rows of a Table. It should select from top 2 row,top3 row and top4 row. Thanks in advance Asghar Ali Mohammed http://www.aliwebdev.com(Web Designer and Developer)Do not forget to "MARK AS ANSWER" on the post that helped you. If you can use Linq, you can use Skip. http://msdn.microsoft.com/en-us/vcsharp/aa336757.aspxThanks, EdMicrosoft MVP - ASP/ASP.NET Hii dear..U can fire the Query select Top(3) from Table1 order by id desc.. "A conclusion is whe...

First Row, Next Row, Prior Row, Last Row
I have a SQL Anywhere 7.0 Database, have a table Product_detail which contains Column Name Datatype width Null Default batch_id char(10) No None prod_id Integer No None employee_id Integer No None quantity Integer No None price Numeric (14, 2) No None Its primary key is batch_id I have a Freeform Datawindow with this table I want to provide the first row, next row, prior row and last row Ho...

how to display multiple rows of a table in single row
DECLARE @emp VARCHAR(1024) declare @emp1 varchar(1024)declare @emp2 varchar(1024)SELECT @emp1 = COALESCE(@emp1 + ',', '') + cast(eid as varchar(10)),@emp = COALESCE(@emp + ',', '') + ename ,@emp2 = COALESCE(@emp2 + ',', '') + desigFROM emp SELECT eid=@emp1,ename = @emp,desig=@emp2    anitha123:DECLARE @emp VARCHAR(1024) declare @emp1 varchar(1024)declare @emp2 varchar(1024)SELECT @emp1 = COALESCE(@emp1 + ',', '') + cast(eid as varchar(10)),@emp = COALESCE(@emp + ',', '') + ename ,@emp2 = COALESCE(@emp...

how to compare rows in the datatable and remove the duplicate rows (before removal of duplicate row i need to append those values to original rows)
Hii.             I have a datatable in that i have some rows.. i need to compare those rows one among the other based on first column only. If its duplicate row i need to append those col values to original row. For example here is the data in the table.: Total - 13 columns Name:     Jan:   Feb:   March:...............................Dec  Phani      2        4          ...

Data Controls insert rows into gridview then insert rows from gridview into SQL Table
Hello there, I'm still new at performing miracles with code . Currently I am having trouble with my latest coding adventure I have a web application which records jobs and labour assigned to jobs. The issue in particular I'm having is the way in which labour is to be assigned. I want to use standard controls (Textbox, Dropdownlist) to record the values into a gridview (ie,put multiple rows into the gridview using the controls). Then, when all the inserting is complete, the user clicks a submit button to insert all the rows from the gridview into a database table. The reason for...

ADO.net problem: i can not view image data for the rest of my table rows except the image for the first row but i can read all the other non image fields for all rows.
Hi i have a table with the following fields imgid............int imgdata........image imgtitle.........varchar(max) imgType........varchar(max) imgLength.....bigint incident_id.....int i have no problem with uploading the image but viewing the uploaded image(s) in a gridview has caused me great pain. The probelm is i have two pages. page1 grabs the image to display and page2 has a gridview that displays the grabed image. I wanted to have an sql statement like SELECT * FROM mytable WHERE incident_id=someValue. IF i have 5 records in this table and i view page2 in the browser,  all the table fields  for all records are displayed correctly except for imgData which displys the imgData for the first record for all the records returned by my query. So the problem is, if i had 5 records in this table, only the imgData in first record will be displyed for the rest of the rows. Below is the code for the pageload event in page1(which grabs the image). Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Try Dim qr As String 'pass incident number in query string whose image should be displayed qr = Request.QueryString("id").ToString Dim ds As New DataSet Dim da As New SqlClient.SqlDataAdapter Dim arrContent As Byte() Dim dr As DataRow Dim strSql As String strSql = "Select * from images Where incident_id=" & Request.QueryString("id") Dim connString As String = "Data Source=.\SQLEXPRES...

Display multiple table rows in a single Gridview row?
I have two tables:   transportreply |id| |submitby| |transport| 2008 |id| |liftclub| |liftclubsize| |workfromhome| |leave| |submitby| In the transportreply, there are multiple rows with information submitted by the same user originating from a checkboxlist.  What I need is an inner join of the two tables that display all the results on one Gridview row.  Currently my code looks like this: Results.aspx<table align="center" width="900" bgcolor="#E6E6E6" class="table3"><tr><td><div class="td4" align="center"><u>Results of the Employee Travel Survey<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:sustainabilityConnectionString %>"         SelectCommand="SELECT transportreply.submitby, transportreply.transport, [2008].liftclub, [2008].liftclubsize, [2008].workfromhome, [2008].leave, [2008].submitby AS Expr1 FROM transportreply INNER JOIN [2008] ON transportreply.submitby = [2008].submitby">    </asp:SqlDataSource>    </u></div></td></tr><tr><td align="center">        <asp:GridView ID="GridView1" runat="server" AllowPaging="True"         AllowSo...

Add row to table with table.row.add()
Everytime I click on a button I want to add a tableRow to a table like this:        TextBox TB = new TextBox();                TableCell Cell = new TableCell();        Cell.Controls.Add(TB);        TableRow Row = new TableRow();        Row.Cells.Add(Cell);        table.Rows.Add(Row);It works the first time, but when I click the button again the last r...

Embedding rows into a single row?
Dear All,I need to display a page that shows a data grid, that’s fine. The slight trouble is that each item (a row) on the grid may have 1 or many action items associated with it.So what I’d like to do is display the grid and the rows as normal but embed the 1 or many items in the last column of the grid in each row as needed. Just like splitting some cells into many cells horizontally in an HTML table.How can I achieve this? Any ideas? Are you familiar with using Template columns with DataGrid?  You can simply add a Template column that contains nearly anything you want in terms...

Update a rows in one table for each row in other table
Hello all, i am a newbie in SQL and i want to ask for your help in order to do the following update statement. I have a table tblUsers which holds all the users, one of the fields in their GroupId. In the UserGroup table i have a field "UsersCount" and in that field i want to keep the number of the users in that group. Basically i want everytime i am saving a user to recalculate the users in all usergroups. I am trying to have something like:SELECT User_GroupId, count(User_GroupId) as UsersCount FROM tblUsersWHERE DeletedFlag = 0 GROUP BY User_GroupId and then:"FOR EACH" User_GroupIdUPDATE tblUserGroupsSET UserGroup_UserCount = UsersCountWHERE UserGroup_Id = User_GroupId Thanks a lot. Try this one: UPDATE tblUserGroupsSET UserGroup_UserCount = UsersCountFROM tblUsersGroups t join(SELECT User_GroupId, count(User_GroupId) as UsersCount FROM tblUsersWHERE DeletedFlag = 0 GROUP BY User_GroupId) As tmpON t.User_GroupId=tmp.User_GroupIdWelcome to my SQL/ASPNET forum for Chinese http://51up.org/bbs/forumdisplay.php?fid=38 Iori_Jay: Try this one: UPDATE tblUserGroupsSET UserGroup_UserCount = UsersCountFROM tblUsersGroups t join(SELECT User_GroupId, count(User_GroupId) as UsersCount FROM tblUsersWHERE DeletedFlag = 0 GROUP BY User_GroupId) As tmpON t.User_GroupId=tmp.User_GroupId Thank you very much, I will try it very soon! It worked! Thanks a lot!...

Update row in Table A from row in Table B
Hello, I have 2 tables.... table A and table B. Ok, In a stored procedure, I pass in an int value @ID I want to get the row from Table B WHERE ID =@ID....and then UPDATE the Row in Table A that has the same ID...with the values from table B. Table A ID | Col1 | Col2 ----------------------- 2 a a Table B ID | Col1 | Col2 ----------------------- 2 b b I would like to update A.Col1 with B.Col1 and A.Col2 with B.Col2 Can someone help me out with this syntax? Thanks a lot. update tableA ...

tow or more rows in a single row
Guys, I have one senario. Create table Client_Table ( ID int, SUB int, Name varchar(30), Status varchar(10) ) go insert into Client_Table select 9001,4,'Gail','Active' Select 9001,1,'Mark','Active' union all select 9001,2,'Will','InActive' union all select 9001,4,'Gail','Active' union all select 9002,1,'chals','Active' union all select 9003,1,'ken','Active' union all select 9003,2,'dave','Active' union all select 9004,1,'peter','Active' ...

The row number and offset of each row in the page should have a matching entry in row number table
Is the proper correction for the following to recreate the table BCPout/IN or table to table insert, or just drop and recreate the index? Row number is 0. Is there a way to correct just the data page? Table Corrupt: The row number and offset of each row in the page should have a matching entry in row number table; check this page (page#=772121 row#=0 offset in row number table=0) Table Corrupt: The row number and offset of each row in the page should have a matching entry in row number table; check this page (page#=772121 row#=0 offset in row number table=0) Table Corrupt: The row...

Question about inserting a row before the first row of the table ----Stored Procedure
Hi, I have a stored procedure. In the stored procedure, I have a table called "#temp", this table contains 50 rows that I select from other tables. Now I want to insert a row before the first row. How can I do it in SQL Server 2005? Thanks in advance. There is no "order" of rows in a table. You need to define the order with an ORDER BY clause in your SELECT. So have a column with OrderSeq and give it some numbers and order by that column.***********************Dinakar NethiLife is short. Enjoy it.*********************** Thank you very much, ndinakar, you saved my day....

Row ID of the newly inserted row FormView using AccessdataSource
How can I get the AccessDatasource Row ID of the newly inserted row when adding anew record to the database using a FormView Control on a web page?I've looked at the FormView_ItemInserted FormViewInsertedEventArgs but to noavail. can some one give me sample code for it thanks   Hi:   Please check out this article: http://peterkellner.net/2006/12/07/gridviewhighlightlastinsertedrow/   The idea is to use ViewState to store the id of newly inserted record. RegardsSincerely,Allen ChenMicrosoft Online Com...

Saving multiple rows in Oracle DB using ADO.NET
Hi,  I want to know how we can save multiple rows (gridview data) in Oracle DB (using ADO.NET) using a single connection.   Rgds u can use datatable.copy method. Thank uBabaPlease remember to click "Mark as Answer" on this post if it helped you. Hi,   Thanks for your reply. Can you please send me a sample code?   Rgds, Jai...

how to Insert a row in typed dataset datatable in the first row index
 Hi,When we use typed datasets. I have type DataTable: detialstable as detailsdataTableI want to add new detailsRow to detailstable. But I want the row to go to the beginning of the table and not the end.Can any one help pls?Thanks :) Thanks a lot, I appreciate your taking the time to help me.  Hi there,                 you have to use the InsertAt method of DataRowCollection here I put a simple code to see that.         DataSet1 ds = new DataSet1();     ...

DBD::Oracle 2nd insert of row into table with 2 CLOBs hangs
Hi Tim & Folks, We've found a interesting problem when inserting multiple rows into a table containing two CLOB columns. The second execute() hangs and Oracle never responds. The execute() hangs only when the character sizes of the two strings are larger than 4000 characters each, and even then not always. Code is below which demonstrates problem. Any clues as to whether this is in the DBD layer or in Oracle? Thanks!!! DBI Version: 1.48 DBD::Oracle Version: 1.16 Oracle Version: Oracle9i Release 9.2.0.7.0 Operating System: Linux Perl Version: 5.8.7 Code: ...

In vb oDs.Tables(0).Rows(i).Item(0) = strId for that C# oDs.Tables[0].Rows[i].Item[0] = strId; is not working
 In aspx.vb page I have written the code oDs.Tables(0).Rows(i).Item(0) = strId for that I have write C# code like this  oDs.Tables[0].Rows[i].Item[0] = strId;it is giving error that Item[] is not found. For C#, Item for columns is implied.oDs.Tables[0].Rows[i][0] = strId;  Please Mark As Answer posts that helped you."If we learn from our mistakes, I should be brilliant by now."...

Can you display data from a single row in multiple rows using a GridView?
I am currently displaying 3 fields in a gridview and it looks something like this:First Name Last Name Age ======== ======== === Chris Messineo 40 John Smith 35 Tim Jones 30I need to modify the gridview and display a bio, but I want it to display on 1 full line below each line, like this:First Name Last Name Age ======== ======== === Chris Messineo 40 Chris was born in a log cabin... John Smith 35 At the age of 10 John invented... Tim Jones 30 Mr. Jones was always a curious child... Is this even possible in a GridView? And if so, any suggestions on where to start? Thanks a lot,Chris Messineop.s. I still need to have sorting and paging work, although I do not need to sort on the bio info. Dear, friend: According to your scenario. i recommend you to create a FormView with two Rows. You can put the general GridView into the first row and put a Literal control in the second row for displaying the bio info I hope the above information will be helpful. If you have any issues or concerns, please let me know. It's my pleasure to be of assistanceBest Regards,__________________________________________________Sincerely,Rex LinMicrosoft Online Community SupportIf there is any question or the issue is not resolved, please feel free to mark the thread as not resolved Thanks for the suggestion, but I'm not sure it answers my question?  If I unde...

Please help..... SELECT single row from 300,000 rows table
Hello, I'm using ASE 11.5 for NT. I have a table with 300,000 records, and because of there's no fix pattern for the search criteria ,and I have to perform select statement each time to get just a record from that table. And I have to do a loop 300,000 times, // My pb scripts FOR i = 1 to ll_rowcount // ll_rowcount is 300,000 ll_id = i select name into :ls_name, sales into :ll_sales, supervisor_id into :ll_supervisor_id from agent where id = :ll_id; // processing ... lots of code in it upadate agent set sales = :ll_new_sales, commission = :ll_commission from agent where id = :ll_id; update agent set commission = commission + (ll_commission * 0.25) where supervisor = :ll_supervisor_id; NEXT The above works fine but the it's extremely slow, and I also create index for both id and supervisor_id. Are there any ways to speed up the above process? I tried to use datastore, but datastore without indexes will work even slower if everytime we have to find a record starting from scretch. and it is a devil when all 300,000 records have to be updated using Update() function. And, why is the embedded sql statement executing in PB performs so much slower compared to same statement issued through SQL Advantage? even with index built for a particular table, for instant agent table with both id, and supervisor_id indexed, but reponding slowly e...

Web resources about - Inserting all rows of a datatable into Oracle Table in a single shot, not row by row using C# - asp.net.oracle

Inserting Kate
jurvetson posted a photo: the speaking GPS avatar that we came to love.. more prep photos below... You can hear her voice in the video compilation ...

Inserting the Galaxy Note 5’s S Pen backwards can permanently damage the device
One of the features Samsung highlighted when it unveiled the Galaxy Note 5 was the device's new S Pen slot design. The Note 5 features a spring-loaded ...

How the Shift from Swiping to Inserting Cards Will Accelerate Mobile Payments
... this shift is to protect consumers and merchants from fraud. What the industry refers to as "dipping" and consumers and cashiers call "inserting" ...


Inserting Slavery Into The Climate Debate
Chris Hayes compares the fight against fossil fuels to the abolitionist movement. He states plainly that “there is absolutely no conceivable ...

Samsung smart TVs inserting ads into third-party apps
... playback have pissed off a number of consumers. People with smart TVs from Samsung have been complaining that the electronics maker is inserting ...

Samsung: Inserting the S Pen backwards will not break new Galaxy Note 5 units
... according to the company. "Samsung can confirm that the Note 5 internal S Pen mechanism has been changed to avoid the issue caused by inserting ...

Gawker tells Steven Crowder to "stop whining, take your licks, and accept that getting hit in the face ...
"... in the middle of an argument between billionaire-funded know-nothing ideologues and people whose livelihoods and stability are being threatened ...

Gmail's New Interface for Inserting Photos
Gmail has a new interface for adding images to a message. When you click the "insert images" icon, Gmail now shows all the photos highlighted ...

Now Samsung SmartTVs are interrupting users' videos by inserting random ads
... room. Now Samsung is dealing with a new headache: Gigaom reports that Samsung SmartTVs are interrupting users' own video content by inserting ...

Resources last updated: 3/21/2016 12:15:49 PM