Hole Posted November 4, 2003 Posted November 4, 2003 hello I just wanna ask how can i do this. The problem is i have a database that looks like this #232323 xxxxx xxxxx xxxxx xxxxx xxxxx xxxxxxx xxxxxxxxxxxxxxxx xxxxxxxx xxxx #233224 I need to get the xxxxxx into a field in a database. If there is a nice way already present on the board please point me to it, cos im new to VB.net. There are around 3000 such sets in a txt file. Quote
bungpeng Posted November 4, 2003 Posted November 4, 2003 database looks like this? I don't understand what is xxxx xxxx xxxx.... Quote
Hole Posted November 4, 2003 Author Posted November 4, 2003 the xxxxxx are numbers, but i posted xxx instead of them and they are separated by space :) Quote
*Experts* Nerseus Posted November 4, 2003 *Experts* Posted November 4, 2003 Do you mean you have a text file that looks like: #232323 xxxxx xxxxx xxxxx xxxxx xxxxx xxxxxxx xxxxxxxxxxxxxxxx xxxxxxxx xxxx #233224 And you need to parse the numbers into individual fields and save them to the database? -nerseus Quote "I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
*Experts* Nerseus Posted November 5, 2003 *Experts* Posted November 5, 2003 How much programming do you know? Do you know how to connect to the DB and save records? Do you know how to read text files? Do you know how to read in strings and possibly use regular expressions (or just Substring method calls)? -Nerseus Quote "I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
Hole Posted November 5, 2003 Author Posted November 5, 2003 i know how to connect to a database and thats about it. I do know a little about the rest but not enough to write the programm myself. Quote
*Experts* Nerseus Posted November 5, 2003 *Experts* Posted November 5, 2003 Well, we don't write programs for people here. We expect you to try and write the program. As you go along and run into specific problems, we love to help out! I would start by writing a few test apps. Try updating a database table (assuming you already have a table created). Make sure all that code works. Next try reading from the text file. Look at the various classes in System.IO - there are plenty to choose from. Getting to know them so you know which is best is half the fun of programming. Finally, you'll need to parse what you read. You could use simple substring and fixed offsets, or various methods to split the string based on a space, or maybe use Regular Expressions. If you want to try regular expressions, search these forums and the help files for examples. -ner Quote "I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
Hole Posted November 6, 2003 Author Posted November 6, 2003 will do, thx for the help and ill get back here when i hit a problem i cant solve. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.