日期:2014-05-18 浏览次数:20519 次
第一题:
foreach (Control control in this.Controls)
{
if (control is TextBox)
{
TextBox tb = (TextBox)control;
tb.Text = String.Empty;
}
}
第二题 [color=#FF0000]st()方法排序那里不是很会,从网上down下来的,有点小BUG,只做参考[/color]
int[] ar1 ={5,12,9};
int[] ar2 ={0,6,22};
int[] sum = new int[ar1.Length + ar2.Length];
ar1.CopyTo(sum, 0);
ar2.CopyTo(sum, ar2.Length);
int[] k = st(sum);
for (int i = 0; i < sum.Length; i++)
{
Response.Write(k[i] + ",");
}
public int[] st(int[] array)
{
int[] fianlmtm = new int[array.Length];
for (int j = 0; j < array.Length; j++)
{
int last = 0;
for (int i = 1; i < array.Length - j; i++)
{
int t = array[i];
if ((array[i]) < (array[i - 1]))
{
array[i] = array[i - 1];
last = array[i];
array[i - 1] = t;
}
else
{
last = array[i];
}
}
fianlmtm[array.Length - (j + 1)] = last;
}
return fianlmtm;
}
第三题:
mysql:select * from tablename limit 31,40
mssql:select top 10 * from table1 where id not in(select top 10 * from table1)
第四题:不会啊
第五题:太多,只做一题,其他思路也差不多
商品总类名称表 type
id typeAllName
1 教材类
2 连环画
3 非教材类
商品信息表 typeInfo
id typeName typeId typeSum
1 A 1 22
2 B 1 55
3 C 2 55
4 D 2 23
5 E 1 2
6 F 3 22
select i.typeName as 商品名称,
t.typeAllName as 商品类型,
i.typeSum as 商品价格,
sum(typeSum-1) as 商品折扣后价格
from typeInfo i
left join [type] t on i.typeId=t.Id
where i.typeId=1
group by i.typeName,t.typeAllName,i.typeSum
/*
商品名称 商品类型 商品价格 商品折扣后价格
A 教材类 22 21
B 教材类 55 54
E 教材类 2 1
*/
第六题 你还是看这个网址吧:
http://www.cnblogs.com/junjun0803/articles/781807.html
------解决方案--------------------