473,683 Members | 2,848 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Importing a file into SQL Server Express using C# Express

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.
Jun 2 '06 #1
2 1566
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',value 2)
or
Update mytable set 'column name1' = 'value1', columnname2 = value2 where
somefield = somevalue

Robert

"John" <-> wrote in message news:%2******** ********@TK2MSF TNGP05.phx.gbl. ..
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.

Jun 4 '06 #2
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
"Robert Bravery" <me@u.com> wrote in message news:%2******** ********@TK2MSF TNGP04.phx.gbl. ..
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',value 2)
or
Update mytable set 'column name1' = 'value1', columnname2 = value2 where
somefield = somevalue

Robert

"John" <-> wrote in message news:%2******** ********@TK2MSF TNGP05.phx.gbl. ..
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.


Jun 5 '06 #3

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

Similar topics

3
2410
by: AspDotNetDeveloper | last post by:
I'm trying to troubleshoot why my ASP application can no longer send file attachments larger than 100K, and I have eliminated many possibilities already, but I'm running out of ideas. I think I have it narrowed down to an Outlook Express update that is installed on the Win 2K Server, but when I try to remove the update, then the application returns an Unknown Error during the objNewMail.Send function call. The symptoms are empty file...
3
5428
by: Elmo Watson | last post by:
I've been asked to develop a semi-automated type situation where we have a database table (sql server) and periodically, there will be a comma delimited file from which we need to import the data, replacing the old. I naurally know that we can use to kill the other data, but does anyone have any examples of importing a comma delimited file into SQL Server with ASP?
7
3302
by: Timothy Shih | last post by:
Hi, I am trying to figure out how to use unmanaged code using P/Invoke. I wrote a simple function which takes in 2 buffers (one a byte buffer, one a char buffer) and copies the contents of the byte buffer into the character pointer. The code looks like the following: #include <stdio.h> #include <stdlib.h> #include "stdafx.h" BOOL APIENTRY DllMain( HANDLE hModule, DWORD ul_reason_for_call,
1
6001
by: Daniel Manes | last post by:
Some facts: 1) I have an Access database (.mdb file) sitting on my harddrive. 2) I have Visual Studio 2005, Sql Server Express, and Sql Server Management Studio Express. 3) I do *not* have Microsoft Access. What I'm trying to do: I simply want to import the Access database into Sql Server Express. In
2
3173
by: Snozz | last post by:
The short of it: If you needed to import a CSV file of a certain structure on a regular basis(say 32 csv files, each to one a table in 32 databases), what would be your first instinct on how to set this up so as to do it reliably and minimize overhead? There are currently no constraints on the destination table. Assume the user or some configuration specifies the database name, server name, and filename+fullpath. The server is SQL...
4
5623
by: Goofy | last post by:
The add database ( MDF ) in Visual Studio 2005 seems to be in SQL Server 2005 format as far as I can tell. Does anyone know how I can import tables ( without having to start writing queries ) from Access ? -- Goofy
9
3006
by: TC | last post by:
Like a lot of database developers, I often choose Jet for the back- end. I'm starting to worry about what will happen when Jet is deprecated. Ostensibly, Jet users like me must switch to SQL Server (or MSDE / SQL Express), but there's something I just don't understand. Without Jet, how will we create file server database applications? In other words, how will we create multi-user apps which use a file server to share data and don't...
1
3825
by: pompair | last post by:
Hi, Could someone give a pointer how to import couple of hundred images into Sql Server 2005 Express Edition database? Is there a tool for it? Can it be done with Sql Management Studio or is it just a matter of writing own piece of software (a little helper app) to do it? -timonardo
12
10960
by: Darrel | last post by:
I'm still having a hell of a time figuring out this whole SQL Express set up. I finally discovered why I couldn't run the aspnet_regsql...my local sql server wasn't running. I turned that on, and now I can see a list of DBs running locally. However, the .mdf file I have in my app_data folder does NOT appear on this list.
0
9042
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8751
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7581
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6429
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5789
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4299
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4519
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2195
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
1921
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.