Importing a file into SQL Server Express using C# Express

  • Thread starter Thread starter John
  • Start date Start date
J

John

I have a data file with proprietary database formatting from an old DOS programme and want to
extract data from it and import it into SQL Server Express using C# Express. I've managed to work
out how the data is stored in the file by using a hex editor, but don't know how to add it to an SQL
Server Express database using C# Express.

I've watched the Learn Visual Studio.Net beginners videos, but they only tell me how to enter data
though the IDE by typing it.

Example, if I have a table called Customers and a column CustomerId and a column called Name, how do
I set the Name with a string read from my file, and how do I make sure that it goes into the correct
row - I will be supplying the CustomerId, but need to know how to assign this in code too.
 
mmm
No one has answered you yet on this, so here goes
I think it all boils down to sql statements and understanding that
If you have the correct values and you know the corresponing columns, its a
simple thing of either using an update statement or an insert statement.
Read up on SQL statements

Insert into mytable ('column name1', 'columnname2') values ('value1',value2)
or
Update mytable set 'column name1' = 'value1', columnname2 = value2 where
somefield = somevalue

Robert
 
Thanks very much for your reply. I'm a complete beginner, so I guess the question did sound a bit
basic.

The videos make a lot of use of datasets, which seem like a good idea. How do I add items to the
dataset rather than directly to the database?

Thanks again for your help... John


mmm
No one has answered you yet on this, so here goes
I think it all boils down to sql statements and understanding that
If you have the correct values and you know the corresponing columns, its a
simple thing of either using an update statement or an insert statement.
Read up on SQL statements

Insert into mytable ('column name1', 'columnname2') values ('value1',value2)
or
Update mytable set 'column name1' = 'value1', columnname2 = value2 where
somefield = somevalue

Robert
 
Back
Top