Geeks Talk

Prepare for your Next Interview


Welcome to the Geeks Talk forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.

Create datatable in memory

This is a discussion on Create datatable in memory within the C# forums, part of the Software Development category; If I've to read records from a text file and then to create a datatable in memory and add records in it, then how i can set the datatype of ...

Go Back   Geeks Talk > Software Development > C#
Register Blogs FAQ Tag Cloud Calendar Mark Forums Read
  #1 (permalink)  
Old 11-13-2007
Expert Member
 
Join Date: Feb 2007
Posts: 1,279
Thanks: 0
Thanked 192 Times in 154 Posts
Geek_Guest has a spectacular aura aboutGeek_Guest has a spectacular aura aboutGeek_Guest has a spectacular aura about
Create datatable in memory

If I've to read records from a text file and then to create a datatable in memory and add records in it, then how i can set the datatype of each column. Formate of file 'll be like its first line will have name of columns for datatable.
Plzz tell me

Question asked by visitor Sumaira
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 11-26-2007
Junior Member
 
Join Date: Nov 2007
Location: Poland
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
kapiatek is on a distinguished road
Re: Create datatable in memory

Hi Sumaira,
what type of data do You store in file,
are those the delimitered values (like using colon or tab)
or is it just plain text?

as for the datatypes, hmm,
it really depends what sort of data You have in those
columns

can You paste a sample of that data file?

It would be easier then to suggest some solutions

Charles
Reply With Quote
  #3 (permalink)  
Old 12-13-2007
Junior Member
 
Join Date: Dec 2007
Location: Coimbatore,Tamilnadu, India
Posts: 5
Thanks: 0
Thanked 1 Time in 1 Post
chibionos is on a distinguished road
I think i have the solution for your Problem

Hi i may be a little late to answer the question.

Main Concept : Cover the text file in to an XML datafile.
Assumptions Made : Your file contains | Name | some thing | Some thing |
Solution elaborated :
First the file is a text file so reading from the file will not be a problem
Second the file is read and a equivalent XML file can be created

For Example :
Say a record is like this
| Name | Age | Gender |
| Chibi | 20 | Male |

Then we can read the file with readLine() method and the break the data with the separators as the marker.

on breaking this create an XML record
<Student>
<name> Chibi </name>
<age> 20 </age>
<Gender> Male </Gender>
</Student>

Please refer XML materials for further details in how to create the XML file correctly

Then we can do things very easily.
Dataset.readXML("your XML file path goes here");
method can be used to get the Data directly in to the Dataset. Use the Update method to update all the changes from the Dataset to the Database.


I think that will do job.
If any doubt please thread.

Reply With Quote
Reply

  Geeks Talk > Software Development > C#

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads

Thread Thread Starter Forum Replies Last Post
Physical Memory and Virtual Memory blenda Windows 6 07-14-2009 03:22 PM
MemoryCleaner performs fast and powerful memory sweep, removing wasted memory blocks, JobHelper Geeks Lounge 0 10-06-2007 07:13 AM
How to execute second record from run time datatable ? bharathi_ark QTP 1 08-02-2007 02:44 PM
At which memory, VB Coding is stored like hot memory Subashini.Ramasamy VB.NET 0 07-10-2007 09:43 AM
How to place whole table in webpage onto datatable Geek_Guest QTP 0 05-13-2007 08:48 AM


All times are GMT -4. The time now is 11:12 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.3.1
Copyright © 2009 GeekInterview.com. All Rights Reserved