View Single Post
  #6 (permalink)  
Old March 12th, 2009, 03:23 PM
RushNP774 RushNP774 is offline
Authorized User
Join Date: Mar 2009
Posts: 23
Thanks: 2
Thanked 0 Times in 0 Posts

Originally Posted by Lee Dumond View Post
So, let's see if I have it straight. You just want to take a table you have already set up, with no records in it, and populate the Name column of that table with a list of names from a text file (one name per line)?
You got it! I had over 200 records in it (with just the auto generated ID, and the Name that I typed, but nothing in Category), but have since cleared out the table out of frustration

Originally Posted by Lee Dumond View Post
Just read the file one line at a time, then do an INSERT after each line read.
That sounds incredibly simple, but I haven't the slightest idea where to start, nor where to enter the code (in the SQL statement generator?). As I mentioned, I've read about the StreamReader object, but can't figure out from the tutorials how to get it working. Is that even what I should use? If so, I'll try to read more, but I feel like I'm at a dead end at the moment.

Originally Posted by Lee Dumond View Post
Or, you could always type the names in by hand. That's probably what I would do...
I agree with you 100% that it would have been MUCH easier looking back at it. Shoot, I could have had them all typed in 20 times by now. Even so, I figured I'd turn this into a learning experience:
  1. Backup your SQL databases often in case you mess up a statement .
  2. Learn how to read from a text file
  3. Learn how to insert records into a DB via code
Guess I'm just stubborn, but I'm really trying to learn this stuff from the ground up, and am willing to beat myself up learning it well. Plus, this 200 record table could have been a client's 20,000 record table, and I'd rather make my mistakes now instead of then. Ah, the joys of being a newbie...