1、关于构造函数与静态构造函数的题,很简单.
2、关于继承、多态的考察,也很简单。
3、根据委托(delegate)的知识,请完成以下用户控件中代码片段的填写
namespace test
{
public delegate void OnDBOperate();
public class UserControlBase : System.Windows.Forms.UserControl
{
public event OnDBOperate OnNew;
private void toolBar_ButtonClick(objectsender,System.Windows.Forms.ToolBarButtonClickEventArgs e)
{
if(e.Button.Equals(BtnNew))
{
//请在以下补齐代码用来调用OnDBOperate委托签名的OnNew事件。
}
}
}
答:if( OnNew != null )
OnNew( this, e );
4、
public static void test(string ConnectString)
{
System.Data.OleDb.OleDbConnection conn = new System.Data.OleDb.OleDbConnection();
conn.ConnectionString = ConnectString;
try
{
conn.Open();
…….
}catch(Exception Ex)
{
MessageBox.Show(Ex.ToString());
}finally
{
if (!conn.State.Equals(ConnectionState.Closed))
conn.Close();
}
请问
1)以上代码可以正确使用连接池吗?
2)以上代码所使用的异常处理方法,是否所有在test方法内的异常都可以被捕捉并显示出来?
5、问题:Can you use a SQL statement to calculating it!
How can I print "10 to 20" for books that sell for between $10 and $20,"unknown" for books whose price is null, and "other" for all other prices?
答案:
select bookid,bookname,price=case when price is null then 'unknown'
when price between 10 and 20 then '10 to 20' else price end
from books
6、SQLSERVER服务器中,给定表 table1 中有两个字段 ID、LastUpdateDate,ID表示更新的事务号, LastUpdateDate表示更新时的服务器时间,请使用一句SQL语句获得最后更新的事务号。(10)
答:Select ID FROM table1
Where LastUpdateDate = (Select MAX(LastUpdateDate) FROM table1)
7、
题目大意是编写代码,功能是C#实现字符串的如下效果:
输入:"All-In-Love",输出:"All-In-Love"
输入:"All In Love",输出:"Love In All"
输入:"Hello,the world!",输出:"!world the,Hello"
8、数据库操作的考察,比较麻烦。