| |

VerySource

 Forgot password?
 Register
Search
View: 559|Reply: 3

How to put the value retrieved from the database into an array in C #

[Copy link]

3

Threads

5

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 Invalid IP Address

Post time: 2020-2-22 11:00:02
| Show all posts |Read mode
How to put the value taken from the database into an array in C #, is there any relevant code, please refer to it, thank you
Reply

Use magic Report

0

Threads

4

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2020-5-4 07:30:01
| Show all posts
Put it in the DataSet first, then put it in the array
ArrayList arrlist = new ArrayList ();
for (int i = 0; i <= ds.tables ["tb1"]. Rows.Count; i ++)
{
for (int j = 0; j <= ds.tables ["tb1"]. Columns.Count; j ++)
{
 arrlist.Add (ds.tables ["tb1"]. Rows [i] [j] .Tostring ());
}
}
Reply

Use magic Report

0

Threads

4

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2020-5-4 10:30:01
| Show all posts
string [] strArry;
strArry = (string []) arrList.ToArray (Type.GetType ("System.String"));
Reply

Use magic Report

3

Threads

5

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 Invalid IP Address

 Author| Post time: 2020-5-9 09:45:01
| Show all posts
Thank you very much, the function has been realized
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list