rdrunner400
Programmer
Hi,
As you can see from the subject line I am wanting to do the above ... which is import a flat text file into SQL 2005 Express using c# 2008.
I am new to this as we are upgrading from a FOXPRO environment to .net
I have a button on a form which on the click event i have a dialog box that opens and i am able to select a text file, BTW this text file is delimited with a Tab and has around 100,000 records in and in each row there is 130 fields all text with average field lengths of varchar(50). This process will be repeated weekly.
Now i can get the Text file into my SQL DB using Bulk Insert fine.
BUT that is not how it is to be done. NO SIR !!!
I am wanting to just make it so that a form will load and it will load into the SQL nice and easy.
Now i have gone around the net looking for a simple way to import this file..... but its not to be easy....
I know i can use BULK insert or DTS but that is not to be used.... BOTH work fine ... but it needs to run from the click event of the button. I don't want the user to have any access to SQL Server what so ever.
I have succesfully created a connection to the data base.
My DataBase is called TESTDB and the Table name is called TEST_TABLE and i have created the table from the specification given. 130 Text Fields !!! OH !!!!
THE only thing i cannot do is to import the records easily into it..... using code ???
IS there a simple way to do this ?????? Can i connect to the DB and run a stored procedure possibly that i could place the BULK INSERT code in and pass a parameter to the stored procedure stating where to find the file on the server as it will be in different places as each week?
This has been driving me mad for a while ... and i would have thought it would be easy to do as it was in fox alas it is not
Regards,
Murray
As you can see from the subject line I am wanting to do the above ... which is import a flat text file into SQL 2005 Express using c# 2008.
I am new to this as we are upgrading from a FOXPRO environment to .net
I have a button on a form which on the click event i have a dialog box that opens and i am able to select a text file, BTW this text file is delimited with a Tab and has around 100,000 records in and in each row there is 130 fields all text with average field lengths of varchar(50). This process will be repeated weekly.
Now i can get the Text file into my SQL DB using Bulk Insert fine.
BUT that is not how it is to be done. NO SIR !!!
I am wanting to just make it so that a form will load and it will load into the SQL nice and easy.
Now i have gone around the net looking for a simple way to import this file..... but its not to be easy....
I know i can use BULK insert or DTS but that is not to be used.... BOTH work fine ... but it needs to run from the click event of the button. I don't want the user to have any access to SQL Server what so ever.
I have succesfully created a connection to the data base.
My DataBase is called TESTDB and the Table name is called TEST_TABLE and i have created the table from the specification given. 130 Text Fields !!! OH !!!!
THE only thing i cannot do is to import the records easily into it..... using code ???
IS there a simple way to do this ?????? Can i connect to the DB and run a stored procedure possibly that i could place the BULK INSERT code in and pass a parameter to the stored procedure stating where to find the file on the server as it will be in different places as each week?
This has been driving me mad for a while ... and i would have thought it would be easy to do as it was in fox alas it is not
Regards,
Murray