| |

VerySource

 Forgot password?
 Register
Search
View: 690|Reply: 5

How to get the number of query columns in the code below

[Copy link]

1

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-1-22 02:00:02
| Show all posts |Read mode
private BindingManagerBase bm;

con = new OleDbConnection (constring); // Connect to the database
con.Open ();
adapter = new OleDbDataAdapter (@ "select * from theme where kemu = '" + lx + "' and teacher = '" + tch + "' order by newid ()", con);
rs = adapter.SelectCommand.ExecuteReader ();
rs.Read ();

bm = rs.? // Number of eligible records
Reply

Use magic Report

0

Threads

322

Posts

115.00

Credits

Newbie

Rank: 1

Credits
115.00

 China

Post time: 2020-1-31 16:18:01
| Show all posts
datareader does not have this feature.
Reply

Use magic Report

0

Threads

322

Posts

115.00

Credits

Newbie

Rank: 1

Credits
115.00

 China

Post time: 2020-1-31 16:27:01
| Show all posts
Read only one by one, unless using a DataTable
Reply

Use magic Report

0

Threads

58

Posts

32.00

Credits

Newbie

Rank: 1

Credits
32.00

 China

Post time: 2020-1-31 16:54:01
| Show all posts
int i = 0 // i is the number of rows
while (rs.Read ()) i ++;
Reply

Use magic Report

0

Threads

119

Posts

67.00

Credits

Newbie

Rank: 1

Credits
67.00

 China

Post time: 2020-1-31 18:18:01
| Show all posts
int i = 0;
while (rs.Read ())
{
 i ++;
}
Reply

Use magic Report

1

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

 Author| Post time: 2020-1-31 20:27:01
| Show all posts
I am an online test system. The generated questions and number are random. I must put the answers to multiple choices in an array. To determine the length of the array, I must obtain the length of the query result (the number of questions generated). Also do the navigation bar (previous question, next question, first question, last question). How to achieve it, please master click, ASP. New to .NET!
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