There is a multilinetextbox.i want to insert the data into database [Resolved]

Posted by Santosh.Choudhury under ASP.NET on 4/12/2012 | Points: 10 | Views : 1280 | Status : [Member] | Replies : 13
There is a multilinetextbox.There are some data which are separated by comma when i click in insert button then all these are inserted in different column divide by comma.
example :
santosh,ram,shyam

all are inserted in 3 column
santtosh
ram
shyam Then how is posoble




Responses

Posted by: Sakthi.Singaravel on: 4/12/2012 [Member] Silver | Points: 50

Up
0
Down

Resolved
u are welcome..


Regards,
Singaravel M

Santosh.Choudhury, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Kavi.Sirius on: 4/12/2012 [Member] Starter | Points: 25

Up
0
Down
hi,
whether u want to insert the data in one column or three different columns

if u want to on column means

use "string builder"
or
eg:
string strCoordinates = string.Empty;
strCoordinates = textbox1.Text + "," + textbox2.Text +"," + textbox3.Text + "," + textbox4.Text;




Regards
Kavi.n

Santosh.Choudhury, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sakthi.Singaravel on: 4/12/2012 [Member] Silver | Points: 25

Up
0
Down
Hi kavi,

santhosh told multiline text and inserted to three diff columns...


Regards,
Singaravel M

Santosh.Choudhury, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sakthi.Singaravel on: 4/12/2012 [Member] Silver | Points: 25

Up
0
Down
Hello Santosh,

Here u can use regex or string.split() function for spliting the names....



Regards,
Singaravel M

Santosh.Choudhury, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Santosh.Choudhury on: 4/12/2012 [Member] Starter | Points: 25

Up
0
Down

ya i want to insert it in 3 different column .please tell me how i use string split() function.give me a small example

Santosh.Choudhury, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sakthi.Singaravel on: 4/12/2012 [Member] Silver | Points: 25

Up
0
Down
Program that splits on spaces [C#]

using System;

class Program
{
static void Main()
{
string s = "singa, raman, karthick";
//
// Split string on commas.
// ... This will separate all the words.
//
string[] words = s.Split(',');
foreach (string word in words)
{
Console.WriteLine(word);
}
}
}

Output

singa
raman
karthick


Regards,
Singaravel M

Santosh.Choudhury, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sakthi.Singaravel on: 4/12/2012 [Member] Silver | Points: 25

Up
0
Down
that code for spliting string and stored to array...

u can use splited string as...

words[0], words[1], words[2]

Now u can use code given by Kavi

Regards,
Singaravel M

Santosh.Choudhury, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sakthi.Singaravel on: 4/12/2012 [Member] Silver | Points: 25

Up
0
Down
is it working...?

Regards,
Singaravel M

Santosh.Choudhury, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Santosh.Choudhury on: 4/12/2012 [Member] Starter | Points: 25

Up
0
Down
yes thankss sakthi.


Santosh.Choudhury, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Kavi.Sirius on: 4/12/2012 [Member] Starter | Points: 25

Up
0
Down
hi sakthi,

i didt get the question correctly.k
now explain clearly

Regards
Kavi.n

Santosh.Choudhury, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sakthi.Singaravel on: 4/12/2012 [Member] Silver | Points: 25

Up
0
Down
Hello kavi,

1. input gets from multiline textbox...
2. split that input to three names (seprated by comma(,))
3. insert into three columns in db



Regards,
Singaravel M

Santosh.Choudhury, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Kavi.Sirius on: 4/12/2012 [Member] Starter | Points: 25

Up
0
Down
kk fine
thank u


Regards
Kavi.n

Santosh.Choudhury, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sakthi.Singaravel on: 4/12/2012 [Member] Silver | Points: 25

Up
0
Down
u are welcome

Regards,
Singaravel M

Santosh.Choudhury, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response