473,395 Members | 1,471 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

text and dataset

hi,
can i update/insert my database by reading the data from text file with
dataset. or if you have a better and faster way please share me. cause my
database has more than two million records and text file has more than
20,000 lines. :(

thanks in advance,
myo zaw
Nov 17 '05 #1
2 1195
Myo,

Assuming you want to just add records from the text file to the data
set, what you could do is first create the data set in such a way that it
matches the schema of your database table.

Once you do that, you can create new rows in your data table, the values
of which you get from parsing your text file (or, if you are lucky and it is
a delimited file of some kind, you use the data provider for text in OLE DB
through the System.Data.OleDb namespace).

Once you have your data table populated, you can create a data adapter
which has the InsertCommand set to a command which will insert the new
records. You then pass the data set to the adapter, and the rows should be
in your table.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Myo Zaw" <in********@hotmail.com> wrote in message
news:%2***************@TK2MSFTNGP10.phx.gbl...
hi,
can i update/insert my database by reading the data from text file
with dataset. or if you have a better and faster way please share me.
cause my database has more than two million records and text file has more
than 20,000 lines. :(

thanks in advance,
myo zaw

Nov 17 '05 #2

Nicholas,
Can it also solve the update parts. If not how can i do that.

thanks,
Myo

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:eO**************@tk2msftngp13.phx.gbl...
Myo,

Assuming you want to just add records from the text file to the data
set, what you could do is first create the data set in such a way that it
matches the schema of your database table.

Once you do that, you can create new rows in your data table, the
values of which you get from parsing your text file (or, if you are lucky
and it is a delimited file of some kind, you use the data provider for
text in OLE DB through the System.Data.OleDb namespace).

Once you have your data table populated, you can create a data adapter
which has the InsertCommand set to a command which will insert the new
records. You then pass the data set to the adapter, and the rows should
be in your table.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Myo Zaw" <in********@hotmail.com> wrote in message
news:%2***************@TK2MSFTNGP10.phx.gbl...
hi,
can i update/insert my database by reading the data from text file
with dataset. or if you have a better and faster way please share me.
cause my database has more than two million records and text file has
more than 20,000 lines. :(

thanks in advance,
myo zaw


Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: foobar | last post by:
I'm exporting data from sqlserver into a text file. I don't want to use a linked server or DTS. I have no problem getting the data into the correct dataset (the dataset linked to the text...
2
by: Todd_M | last post by:
I was wondering what anyone might suggest as "best practice" patterns for streaming out fixed formatted text files with C#? Let's say we get our data in a dataset table and we need to iterate over...
2
by: The Bear | last post by:
After a dataset has been populated from a text file, is it possible to update a text file from a dataset once changes are made? TB
4
by: gj | last post by:
Hi, I'm trying to update a sql database from a web form using text boxes. I'm trying to learn C# on my own so I am at a complete loss. I created my sql connection, data adapter, dataset and data...
2
by: Alpha | last post by:
Hi, I have a window based program. One of the form has several textboxes and a datagrid. The textboxes are bind to the same dataset table as the datagrid and the text changes to reflect different...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.