首页 新闻 会员 周边

Mobile调用Java书写的WebService方法

0
悬赏园豆:10 [已关闭问题]

我在Java中书写的WebService方法
public Object[] GetValues(String sql, String[] param) throws SQLException {

ArrayList <Object> list = new ArrayList <Object>();
try {
con = getConn();
ps = con.prepareStatement(sql);
if (param != null) {
for (int i = 0; i < param.length; i++) {
ps.setString(i + 1, param[i]);
}
}
res = ps.executeQuery();
int count = res.getMetaData().getColumnCount();
while (res != null && res.next()) {
ArrayList <Object> array = new ArrayList <Object>();
for (int i = 1; i <= count; i++) {
array.add(res.getObject(i));
}
list.add(array.toArray());
}
} catch (SQLException e) {
e.printStackTrace();
} finally {
closeAll(res, ps, con);
}
return list.toArray();
}
在C# WinForm中调用时可以把返回的结果作为一个二维数组使用。
foreach (object[] obj in dataSource)
                {
                    columnsNumber = obj.Length;
                    break;
                }
来获取他们中的数据
但是在C# Windows Mobile中使用用时
foreach (object[] obj in dataSource)
                {
                    columnsNumber = obj.Length;
                    break;
                }
foreatch开始报错误,因为此时dataSource中存放的不再是数组。
为什么呢?

Mobile初学者的主页 Mobile初学者 | 初学一级 | 园豆:190
提问于:2009-10-15 17:37
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册