table1 ---

column1
1002008000300-53-9

table2---

column1 column2 column3
1002008000300 53 9

how to populate from table1 to table2

SQL and ASP.Net(Csharp)

Recommended Answers

All 2 Replies

Should've really asked this in an SQL or C# forum.

@kaziraja, you can use the String class' Split method.

C#: String.Split()

table2 = new Table2();  // Assumes a Table2 entity exists.
string source="1002008000300-53-9"

string[] codeParts = source.split('-');

// Assign split values to your table2 entity
table2.column1 = Int32.Parse( codeParts[0]);
table2.column2 = Int32.Parse( codeParts[1]);
table2.column3 = Int32.Parse( codeParts[2]);

// Go persist into your database...
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.