Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Mar 2012
    Posts
    27
    Thanks
    1
    Thanked 0 Times in 0 Posts

    CSV(Comma Separated Value) Problem

    I have a form where to user inputs all the date. Now I need to save all the data in the form on a server(fictitious). How to do that?
    After recording it in the database, I'll need to import it in a database. How achieve this?

  • #2
    Senior Coder alykins's Avatar
    Join Date
    Apr 2011
    Posts
    1,928
    Thanks
    46
    Thanked 203 Times in 202 Posts
    assuming they entered it into textbox1
    Code:
    string contents = textbox1.Text;
    string[] splitS = contents.Split(',');
    example console code...
    Code:
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    
    namespace DaysDemo
    {
        class _DaysDemo
        {
            static void Main(string[] args)
            {
                string demo = "demo,meod,toodle,cat";
                string[] splits = demo.Split(',');
                foreach (string s in splits)
                {
                    Console.WriteLine(s);
                }
                Console.ReadLine();
            }
        }
    }
    Edit: oh and as follow up to you other Q's... after it's split convert it to the appropriate datatype and pass it to database

    I code C hash-tag .Net
    Reference: W3C W3CWiki .Net Lib
    Validate: html CSS
    Debug: Chrome FireFox IE


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •