如何在按钮点击时逐个从数据库中选择数据

问题描述:

hii,

我正在创建一个在线考试网站。我想在面板中显示问题和ans作为单选按钮选项。另外,我想通过下一步按钮点击数据库中的下一个问题和上一页按钮上的上一个问题点击..我无法这样做... PLZ通过提供代码来帮助我...

任何建议都将受到赞赏。

hii,
I'm creating an online examination website. I want to display the question and ans as radio button options inside a panel. Also, I want to get next question from database on 'Next' button click and previous question on 'Previous' button click.. I'm unable to do so... plz help me by providing code for it...
any suggestion will be appreciated.

我们不做你的作业:这是有原因的。它就是为了让你思考你被告知的事情,并试着理解它。它也在那里,以便您的导师可以识别您身体虚弱的区域,并将更多的注意力集中在补救措施上。



亲自尝试,你可能会发现它不是和你想的一样困难!



如果遇到具体问题,请询问相关问题,我们会尽力提供帮助。但是我们不打算为你做这一切!
We do not do your homework: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that your tutor can identify areas where you are weak, and focus more attention on remedial action.

Try it yourself, you may find it is not as difficult as you think!

If you meet a specific problem, then please ask about that and we will do our best to help. But we aren't going to do it all for you!


嘿请试试这个:

你可以用session来存储数据。



从数据库中获取数据并将其存储在数据表中并使用session保存,现在还将变量x初始化为0,在每次按钮单击时,将1添加到x和再次将它存储到session并存储来自session的数据表,并使用row属性,你可以在每次点击时获取下一行。





datatable dt = new datatable();

da.fill(dt);

session [data] = dt;





和每个按钮点击这样使用..



dt.rows [x] [columnfield] .tostring( );





thanx
hey please try this:
You can use session to store data.

fetch data from database and store it in a data table and save it using session, now also put a variable x initialize with 0, on each button click, add "1" to x and again store it into session and store data table from session and using row property you can fetch next row on each click.


datatable dt=new datatable();
da.fill(dt);
session["data"]=dt;


and on each button click use like this..

dt.rows[x][columnfield].tostring();


thanx