473,322 Members | 1,736 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Add a list stored in a text file to a SQL Server 2005 database

Hi I am coding an ASP .Net project in C# and am using connection strings to connect to a Microsoft SQL Server 2005 database, and the project involves tracking student attendance records at a university.

I have a table for each class in the uni, and the only field is StudentNumber. Whenever an admin wants to add a new module, a new table is created, and then whenever he wants to add students to that class table he has to currently add each student number to the table individually.

I am looking for a way so that if an admin has a list of student numbers in a text file, he can just submit this text file to my application and the C# will parse this text file and add each individual student number to this table.

Does anybody know any SQL commands that will let me do this or know how I can get the application to ask the user to submit a file?
Apr 21 '08 #1
1 1244
ck9663
2,878 Expert 2GB
Hi I am coding an ASP .Net project in C# and am using connection strings to connect to a Microsoft SQL Server 2005 database, and the project involves tracking student attendance records at a university.

I have a table for each class in the uni, and the only field is StudentNumber. Whenever an admin wants to add a new module, a new table is created, and then whenever he wants to add students to that class table he has to currently add each student number to the table individually.

I am looking for a way so that if an admin has a list of student numbers in a text file, he can just submit this text file to my application and the C# will parse this text file and add each individual student number to this table.

Does anybody know any SQL commands that will let me do this or know how I can get the application to ask the user to submit a file?

option 1:
1. Ask for the file name (with path) as parameter in an upload utility that you can create. (catch: the text file has to be on a drive that the server can see)
2. Use BULK INSERT to convert the text file into table.
3. Use T-SQL to update all other table.

option 2:
1. Ask for the file name (with path) as parameter in an upload utility that you can create.
2. Using C#, parse the text file, assuming one row = one record.
3. Do an INSERT for ever row on your text file.

-- CK
Apr 21 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Wysiwyg | last post by:
I was hoping to get some opinions on the efficiency of various methods of reusing the same dropdown list data. Here is the situation: Multiple panels on maintenance pages with TAB menus across...
6
by: SandySears | last post by:
I am trying to use a stored procedure to insert a record using VS 2005, VB and SQL Server Express. The code runs without errors or exceptions, and returns the new identifer in the output...
1
by: mickyang | last post by:
My MS-SQL 2000 Database have 50 more Stored Procedure . How to FAST and EASY ENCRYPTION ALL Stored Procedure in my MS-SQL Database?
7
by: Siv | last post by:
Hi, I have a stored procedure that I want to execute and then wait in a loop showing a timer whilst it completes and then carry on once I get notification that it has completed. The main reason...
11
by: eureka | last post by:
Hi All, I'm training in Servlets, JSP and JavaScript, I have a web page in which there's a "StudentName" textbox and below it is a "Names" Dropdown list. Initially the Textbox is empty and...
7
by: mkarbarz | last post by:
Hello, I need to come up with a stored procedure that will allow me to read data from another database. The database I need to read the data from is a UniData residing on a Unix server. The...
1
by: sheenaa | last post by:
Hello Members, I m creating my application forms in ASP.Net 2005 C# using the backend SQL Server 2005. What i have used on forms :: ? On my first form i have used some...
2
by: SQL Server | last post by:
Is there a built in stored procedure that would allow me to list out the database permissions assigned to a particular user or role?
2
by: pozze | last post by:
Hi, I need to display images and other record information retrieved from an SQL 2005 database in a datagrid on a web page. I'm coding in VB .net I have recently changed over from VB ASP and i'm...
2
by: moorcroft | last post by:
Hi I am coding an ASP .Net project in C# and am using connection strings to connect to a Microsoft SQL Server 2005 database, and the project involves tracking student attendance records at a...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.