Click here to Skip to main content
14,735,876 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
help me please

i want to import test.csv into database using

first i will upload test.csv into text box
and after that i will click "submit" button to import it into the database sqlserver

i want to put test.csv into
table name which contains name,contacts

i hope someone can help me because it is urgent

This looks suspiciously a lot like homework.

So here is a way to get you started (nobody will just give you the code for this)

Step 1 : create form with textbox (probably better to take a richtextbox since that's multiline)

Step 2: read the .csv file (it's just a text file so read it like any other text file) in the load / shown / button click event
You can use several methodes for this (streamreader / / ...)

Step 3: write it to the database (look into connecting to database)
You'll need the namespace:
look into: sqlconnection / sqlcommand / sqlparamater (very important) / sqltransaction / ...

You'll also need to know how to split the text you'v read into the corresponding columns. (usually there is a character indicating the start of a new column)

You'll have to the research on your own for this.
its not a homework.but i just learn only 2 days and i need to learn very fast because i have urgent matters
i have done the upload part.where i click upload and the test.csv were uploaded into the text box

the problem is
i just need "submit" button to work.but it seems didnt work out.i want it when i click submit, it will import the test.csv to sms_contact table in sql server
noob here.need an example to learn from
If you need an example, then I suggest you use google. There is a wealth of information on how to do just what you are asking.

Here, I've done the hard part for you:[^]

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900