使用WebServices找不到数据源,哭了一个月也没解决……

shenshanlaoguai 2004-08-20 01:57:42
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Data.OleDb;

namespace AAAA
{
/// <summary>
/// WebForm1 的摘要说明。
/// </summary>
public class WebForm1 : System.Web.UI.Page
{
protected System.Web.UI.WebControls.DataGrid DataGrid1;

private void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
WebReference.ServiceOracle DBS = new AAAA.WebReference.ServiceOracle();
string sqlstr = "SELECT * FROM \"DB\".\"TABLE\" ORAID <> 1";
DataSet DS = DBS.SelectOracle(sqlstr,"TABLE");
DataGrid1.DataSource = DS.Tables["TABLE"].DefaultView;
DataGrid1.DataBind();
}

#region Web 窗体设计器生成的代码
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}

/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Page_Load);

}
#endregion
}
}

说明:以上是我用VC.NET开发工具创建了一个ASP.NET下的AAAA解决方案中WebForm1.aspx的cs代码,在WebForm1窗体上放置了一个DataGrid1控件,在该项目中我做了Web引用,其中WebReference是我引用的WebServices,名称是ServiceOracle,SelectOracle是方法,后台数据库是Oracle9i。调试运行时提示我未提供任何数据源,为此郁闷了一个月,至今泪水涟涟...。。。ooo000
没办法,系统提示我最多只能散100分。
...全文
265 17 打赏 收藏 转发到动态 举报
写回复
用AI写文章
17 条回复
切换为时间正序
请发表友善的回复…
发表回复
So1o 2004-12-01
  • 打赏
  • 举报
回复
哭了一个月当然解决不了
shenshanlaoguai 2004-10-28
  • 打赏
  • 举报
回复
谢谢楼上各位,我的网因欠费停了快三个月,今天才能上来。中间偶尔拨号上来,但是打开这里巨慢。今天上来就为结帖,赶紧散分。这么长时间,真对不起啊!
shenlongju 2004-09-18
  • 打赏
  • 举报
回复
1,要确信IIS开启好用,oracle有自己的httpserver把iis给关了
2,看看vs.net连结oracle是否有问题,他的连结比sql麻烦一些
yingshis 2004-09-18
  • 打赏
  • 举报
回复
up
beijingbeerman 2004-09-18
  • 打赏
  • 举报
回复
在web services的接口处这里DBS.SelectOracle(sqlstr,"TABLE")要加 as dataset,因为他返回的是xml,但必须是dataset光是return dataset不行!
gbbword 2004-09-18
  • 打赏
  • 举报
回复
替你顶!
hxhbluestar 2004-09-18
  • 打赏
  • 举报
回复
说说我的一点看法:

“我内容中给出的代码,在win程序中可以找到数据源,并能返回DataSet,但在web方式就返回不了”
1、我觉得你可以在WebService的Web.Config文件中添加下面代码:
<webServices>
<protocols>
<add name="HttpPost"/>
<add name="HttpGet"/>
</protocols>
</webServices>
允许使用 HttpPost 和 HttpGet 方法调用 WebService

2、你是否是远程调用WebService,如果是远程的话,你的WebService 应该放在具有 公网固定IP的服务器上
webserv2 2004-09-15
  • 打赏
  • 举报
回复
你直接在IE输入你的服务地址,测试一下看看有没有返回结果!不就再是不是服务段的问题了
roseguns 2004-09-15
  • 打赏
  • 举报
回复
555555555555,只好再哭一个月吧.
yichuan1982 2004-09-15
  • 打赏
  • 举报
回复
up
BlueLevin 2004-08-21
  • 打赏
  • 举报
回复
WebReference.ServiceOracle DBS = new AAAA.WebReference.ServiceOracle();
你这句是不是调用了其它项目的引用?看看你调用的代码有没有问题
thinkingforever 2004-08-20
  • 打赏
  • 举报
回复
应该是你Web Services 的问题,检查一下Web Services中的连接数据库的代码,如果是写在配置文件中,检查配置文件中的连接字符串
Tomgus 2004-08-20
  • 打赏
  • 举报
回复
应该是你的Web Services 服务端问题。
可以在服务端新建aspx页面,来连数据库,试试看问题?
huangsuipeng 2004-08-20
  • 打赏
  • 举报
回复
搞定无?GZ
shenshanlaoguai 2004-08-20
  • 打赏
  • 举报
回复
我内容中给出的代码,在win程序中可以找到数据源,并能返回DataSet,但在web方式就返回不了,楼上各位的提示,我试一试哈。
saucer 2004-08-20
  • 打赏
  • 举报
回复
>>>运行时提示我未提供任何数据源

is that the error message on the web service side? how did you connect to the database? did you check if there are any records coming back?

DataSet DS = DBS.SelectOracle(sqlstr,"TABLE");
Response.Write(DS != null);
Response.Write(DS.Tables.Count);
Response.Write(DS.Tables["TABLE"].Rows.Count);

//DataGrid1.DataSource = DS.Tables["TABLE"].DefaultView;
//DataGrid1.DataBind();

12,162

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 Web Services
社区管理员
  • Web Services社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧