1. a=5, b=(++a)+(a++)+(a++), printf("%d",b);
答案:19
2. 表students,有id, classid, name, score。
- 班级为4的所有学生?
答案:select * from students where classid=4
- 每个班级的学生总数?
答案:select classid, count(*) as total from students group by classid
- 每个班级的最高分记录?
答案:select classid, max(score) as maxNumber from students group by classid
3. 使用数据库连接字符串是:Data Source=localhost; Initial Catalog=school; User ID=admin; Password=admin显示students表中所有的数据;
答案:
![ContractedBlock.gif](https://www.cnblogs.com/Images/OutliningIndicators/ContractedBlock.gif)
![ExpandedBlockStart.gif](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
using System.Data.SqlClient;
namespace WebApplication1
{
public partial class DataReader : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string strConnection = "Data Source=localhost; Initial Catalog=InterviewExam; User Id=sa; Password=tingate587";
string strSQL = "select * from student";
SqlConnection objConnection = new SqlConnection(strConnection);
SqlCommand objCommand = new SqlCommand(strSQL, objConnection);
objConnection.Open();
SqlDataReader objReader = objCommand.ExecuteReader();
while(objReader.Read())
{
Response.Write(objReader["Name"].ToString());
}
objConnection.Close();
}
}
}
4. aspx页面如何调用.cs文件中的变量?
答案:<% =变量名 %>
5. 编写一段javascript代码实现检查name输入框不能为空,age输入框只能填写数字;
答案:
6. 简述对CSS与DIV的了解。
答案:
7. 有一个DATATABLE,如何不用服务器控件来实现显示。
答案: