bdp的问题 ,救急!!! ( 积分: 100 )

J

jjhxp

Unregistered / Unconfirmed
GUEST, unregistred user!
bdp的问题
用bdp连接SQL数据库,在bdpDataAdapter中可以Preview数据,但dataGrid不能正常显示数据,run出现错误如下:急!!!
“/WebApplication1”应用程序中的服务器错误。
--------------------------------------------------------------------------------
Connection open failed. SQL State: 42000, SQL Error Code: 18456
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。
异常详细信息: Borland.Data.Common.BdpException: Connection open failed. SQL State: 42000, SQL Error Code: 18456
源错误:

行 229: this.Load += new System.EventHandler(this.Page_Load);
行 230: this.DataBinding += new System.EventHandler(this.Page_Load);
行 231: ((System.ComponentModel.ISupportInitialize)(this.bdpDataAdapter1)).EndInit();
行 232: ((System.ComponentModel.ISupportInitialize)(this.dataSet1)).EndInit();
行 233: ((System.ComponentModel.ISupportInitialize)(this.Table1)).EndInit();

源文件: c:/Inetpub/wwwroot/WebApplication1/WebForm1.aspx.cs 行: 231
堆栈跟踪:

[BdpException: Connection open failed. SQL State: 42000, SQL Error Code: 18456
]
Borland.Data.Provider.BdpDataAdapter.b()
Borland.Data.Provider.BdpDataAdapter.EndInit()
WebApplication1.WebForm1.InitializeComponent() in c:/Inetpub/wwwroot/WebApplication1/WebForm1.aspx.cs:231
WebApplication1.WebForm1.OnInit(EventArgs e) in c:/Inetpub/wwwroot/WebApplication1/WebForm1.aspx.cs:57
System.Web.UI.Control.InitRecursive(Control namingContainer) +240
System.Web.UI.Page.ProcessRequestMain() +174
 
bdp的问题
用bdp连接SQL数据库,在bdpDataAdapter中可以Preview数据,但dataGrid不能正常显示数据,run出现错误如下:急!!!
“/WebApplication1”应用程序中的服务器错误。
--------------------------------------------------------------------------------
Connection open failed. SQL State: 42000, SQL Error Code: 18456
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。
异常详细信息: Borland.Data.Common.BdpException: Connection open failed. SQL State: 42000, SQL Error Code: 18456
源错误:

行 229: this.Load += new System.EventHandler(this.Page_Load);
行 230: this.DataBinding += new System.EventHandler(this.Page_Load);
行 231: ((System.ComponentModel.ISupportInitialize)(this.bdpDataAdapter1)).EndInit();
行 232: ((System.ComponentModel.ISupportInitialize)(this.dataSet1)).EndInit();
行 233: ((System.ComponentModel.ISupportInitialize)(this.Table1)).EndInit();

源文件: c:/Inetpub/wwwroot/WebApplication1/WebForm1.aspx.cs 行: 231
堆栈跟踪:

[BdpException: Connection open failed. SQL State: 42000, SQL Error Code: 18456
]
Borland.Data.Provider.BdpDataAdapter.b()
Borland.Data.Provider.BdpDataAdapter.EndInit()
WebApplication1.WebForm1.InitializeComponent() in c:/Inetpub/wwwroot/WebApplication1/WebForm1.aspx.cs:231
WebApplication1.WebForm1.OnInit(EventArgs e) in c:/Inetpub/wwwroot/WebApplication1/WebForm1.aspx.cs:57
System.Web.UI.Control.InitRecursive(Control namingContainer) +240
System.Web.UI.Page.ProcessRequestMain() +174
 
是不是IIS目錄沒有權限?
 
hotboys:
IIS权限已全部开放,但就是不行.为什么在dataGrid中可以显示表头,但不能显示数据???
 
Page_Load中有沒有綁定數據集?
IIS目錄首頁有沒有設成你運行的第一個頁面文件,如你的是webform1.aspx,就要改為這個。
 
hotboys:
谢谢你的回答,关于你提的两个问题我都已经是考虑了,但结果还是一样.
Connection open failed. SQL State: 42000, SQL Error Code: 18456
 
把代码贴上来吧
 
hotboys:
使用控件bdpConnection1,bdpDataAdapter1,dataSet1,dataGrid1.
code is as follows:
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;
namespace WebApplication5
{
/// <summary>
/// Summary description for WebForm1.
/// </summary>
public class WebForm1 : System.Web.UI.Page
{
protected Borland.Data.Provider.BdpConnection bdpConnection1;
protected Borland.Data.Provider.BdpDataAdapter bdpDataAdapter1;
protected Borland.Data.Provider.BdpCommand bdpSelectCommand1;
protected Borland.Data.Provider.BdpCommand bdpInsertCommand1;
protected Borland.Data.Provider.BdpCommand bdpUpdateCommand1;
protected Borland.Data.Provider.BdpCommand bdpDeleteCommand1;
protected System.Data.DataSet dataSet1;
protected System.Data.DataTable dataTable1;
protected System.Web.UI.WebControls.DataGrid dataGrid1;
protected System.Data.DataTable Table2;
protected System.Data.DataColumn dataColumn1;
protected System.Data.DataColumn dataColumn2;
protected System.Data.DataColumn dataColumn3;
protected System.Data.DataColumn dataColumn4;
protected System.Data.DataColumn dataColumn5;
private void Page_Load(object sender, System.EventArgs e)
{
this.dataGrid1.DataBind();
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}

/// <summary>
/// Required method for Designer support -do
not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.bdpConnection1 = new Borland.Data.Provider.BdpConnection();
this.bdpDataAdapter1 = new Borland.Data.Provider.BdpDataAdapter();
this.dataSet1 = new System.Data.DataSet();
this.dataTable1 = new System.Data.DataTable();
this.Table2 = new System.Data.DataTable();
this.dataColumn1 = new System.Data.DataColumn();
this.dataColumn2 = new System.Data.DataColumn();
this.dataColumn3 = new System.Data.DataColumn();
this.dataColumn4 = new System.Data.DataColumn();
this.dataColumn5 = new System.Data.DataColumn();
this.bdpDeleteCommand1 = new Borland.Data.Provider.BdpCommand();
this.bdpInsertCommand1 = new Borland.Data.Provider.BdpCommand();
this.bdpSelectCommand1 = new Borland.Data.Provider.BdpCommand();
this.bdpUpdateCommand1 = new Borland.Data.Provider.BdpCommand();
((System.ComponentModel.ISupportInitialize)(this.bdpDataAdapter1)).begin
Init();
((System.ComponentModel.ISupportInitialize)(this.dataSet1)).begin
Init();
((System.ComponentModel.ISupportInitialize)(this.dataTable1)).begin
Init();
((System.ComponentModel.ISupportInitialize)(this.Table2)).begin
Init();
this.dataGrid1.DataBinding += new System.EventHandler(this.Page_Load);
this.dataGrid1.Load += new System.EventHandler(this.Page_Load);
//
// bdpConnection1
//
this.bdpConnection1.ConnectionOptions = "";
this.bdpConnection1.ConnectionString = "assembly=Borland.Data.Mssql,Version=1.1.0.0,Culture=neutral,Public" +
"KeyToken=91d62ebb5b0d1b1b;vendorclient=sqloledb.dll;loginprompt=T" +
"rue;osauthen
tication=True;database=master;username=;hostname=jjh;" +
"password=;provider=MSSQL";
//
// bdpDataAdapter1
//
this.bdpDataAdapter1.Active = true;
this.bdpDataAdapter1.DataSet = this.dataSet1;
this.bdpDataAdapter1.DataTable = this.Table2;
this.bdpDataAdapter1.DeleteCommand = this.bdpDeleteCommand1;
this.bdpDataAdapter1.InsertCommand = this.bdpInsertCommand1;
this.bdpDataAdapter1.SelectCommand = this.bdpSelectCommand1;
this.bdpDataAdapter1.StartRecord = 0;
this.bdpDataAdapter1.UpdateCommand = this.bdpUpdateCommand1;
//
// dataSet1
//
this.dataSet1.CaseSensitive = true;
this.dataSet1.DataSetName = "NewDataSet";
this.dataSet1.Locale = new System.Globalization.CultureInfo("zh-CN");
this.dataSet1.Tables.AddRange(new System.Data.DataTable[] {
this.dataTable1,
this.Table2});
//
// dataTable1
//
this.dataTable1.TableName = "Table1";
//
// Table2
//
this.Table2.Columns.AddRange(new System.Data.DataColumn[] {
this.dataColumn1,
this.dataColumn2,
this.dataColumn3,
this.dataColumn4,
this.dataColumn5});
this.Table2.TableName = "Table2";
//
// dataColumn1
//
this.dataColumn1.ColumnName = "name";
//
// dataColumn2
//
this.dataColumn2.ColumnName = "age";
this.dataColumn2.DataType = typeof(int);
//
// dataColumn3
//
this.dataColumn3.ColumnName = "salary";
this.dataColumn3.DataType = typeof(int);
//
// dataColumn4
//
this.dataColumn4.ColumnName = "department";
//
// dataColumn5
//
this.dataColumn5.ColumnName = "id";
//
// bdpDeleteCommand1
//
this.bdpDeleteCommand1.CommandOptions = null;
this.bdpDeleteCommand1.CommandText = "DELETE FROM dbo.jjh_people WHERE name = ? AND age = ? AND salary =" +
" ? AND department = ? AND id = ?";
this.bdpDeleteCommand1.CommandType = System.Data.CommandType.Text;
this.bdpDeleteCommand1.Connection = this.bdpConnection1;
this.bdpDeleteCommand1.ParameterCount = ((short)(5));
this.bdpDeleteCommand1.Parameters.Add(new Borland.Data.Common.BdpParameter("nameOriginal", Borland.Data.Common.BdpType.String, Borland.Data.Common.BdpType.Unknown, 0, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "name", System.Data.DataRowVersion.Current, null));
this.bdpDeleteCommand1.Parameters.Add(new Borland.Data.Common.BdpParameter("ageOriginal", Borland.Data.Common.BdpType.Int32, Borland.Data.Common.BdpType.Unknown, 0, System.Data.ParameterDirection.Input, false, ((byte)(10)), ((byte)(0)), "age", System.Data.DataRowVersion.Current, null));
this.bdpDeleteCommand1.Parameters.Add(new Borland.Data.Common.BdpParameter("salaryOriginal", Borland.Data.Common.BdpType.Int32, Borland.Data.Common.BdpType.Unknown, 0, System.Data.ParameterDirection.Input, false, ((byte)(10)), ((byte)(0)), "salary", System.Data.DataRowVersion.Current, null));
this.bdpDeleteCommand1.Parameters.Add(new Borland.Data.Common.BdpParameter("departmentOriginal", Borland.Data.Common.BdpType.String, Borland.Data.Common.BdpType.Unknown, 0, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "department", System.Data.DataRowVersion.Current, null));
this.bdpDeleteCommand1.Parameters.Add(new Borland.Data.Common.BdpParameter("idOriginal", Borland.Data.Common.BdpType.String, Borland.Data.Common.BdpType.Unknown, 0, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "id", System.Data.DataRowVersion.Current, null));
this.bdpDeleteCommand1.SchemaName = null;
this.bdpDeleteCommand1.Transaction = null;
this.bdpDeleteCommand1.UpdatedRowSource = System.Data.UpdateRowSource.None;
//
// bdpInsertCommand1
//
this.bdpInsertCommand1.CommandOptions = null;
this.bdpInsertCommand1.CommandText = "INSERT INTO dbo.jjh_people (name, age, salary, department, id) VAL" +
"UES (?, ?, ?, ?, ?)";
this.bdpInsertCommand1.CommandType = System.Data.CommandType.Text;
this.bdpInsertCommand1.Connection = this.bdpConnection1;
this.bdpInsertCommand1.ParameterCount = ((short)(5));
this.bdpInsertCommand1.Parameters.Add(new Borland.Data.Common.BdpParameter("name", Borland.Data.Common.BdpType.String, Borland.Data.Common.BdpType.Unknown, 0, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "name", System.Data.DataRowVersion.Current, null));
this.bdpInsertCommand1.Parameters.Add(new Borland.Data.Common.BdpParameter("age", Borland.Data.Common.BdpType.Int32, Borland.Data.Common.BdpType.Unknown, 0, System.Data.ParameterDirection.Input, false, ((byte)(10)), ((byte)(0)), "age", System.Data.DataRowVersion.Current, null));
this.bdpInsertCommand1.Parameters.Add(new Borland.Data.Common.BdpParameter("salary", Borland.Data.Common.BdpType.Int32, Borland.Data.Common.BdpType.Unknown, 0, System.Data.ParameterDirection.Input, false, ((byte)(10)), ((byte)(0)), "salary", System.Data.DataRowVersion.Current, null));
this.bdpInsertCommand1.Parameters.Add(new Borland.Data.Common.BdpParameter("department", Borland.Data.Common.BdpType.String, Borland.Data.Common.BdpType.Unknown, 0, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "department", System.Data.DataRowVersion.Current, null));
this.bdpInsertCommand1.Parameters.Add(new Borland.Data.Common.BdpParameter("id", Borland.Data.Common.BdpType.String, Borland.Data.Common.BdpType.Unknown, 0, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "id", System.Data.DataRowVersion.Current, null));
this.bdpInsertCommand1.SchemaName = null;
this.bdpInsertCommand1.Transaction = null;
this.bdpInsertCommand1.UpdatedRowSource = System.Data.UpdateRowSource.None;
//
// bdpSelectCommand1
//
this.bdpSelectCommand1.CommandOptions = null;
this.bdpSelectCommand1.CommandText = "SELECT name, age, salary, department, id FROM dbo.jjh_people";
this.bdpSelectCommand1.CommandType = System.Data.CommandType.Text;
this.bdpSelectCommand1.Connection = this.bdpConnection1;
this.bdpSelectCommand1.ParameterCount = ((short)(0));
this.bdpSelectCommand1.SchemaName = null;
this.bdpSelectCommand1.Transaction = null;
this.bdpSelectCommand1.UpdatedRowSource = System.Data.UpdateRowSource.None;
//
// bdpUpdateCommand1
//
this.bdpUpdateCommand1.CommandOptions = null;
this.bdpUpdateCommand1.CommandText = "UPDATE dbo.jjh_people SET name = ?, age = ?, salary = ?, departmen" +
"t = ?, id = ? WHERE name = ? AND age = ? AND salary = ? AND depar" +
"tment = ? AND id = ?";
this.bdpUpdateCommand1.CommandType = System.Data.CommandType.Text;
this.bdpUpdateCommand1.Connection = this.bdpConnection1;
this.bdpUpdateCommand1.ParameterCount = ((short)(10));
this.bdpUpdateCommand1.Parameters.Add(new Borland.Data.Common.BdpParameter("name", Borland.Data.Common.BdpType.String, Borland.Data.Common.BdpType.Unknown, 0, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "name", System.Data.DataRowVersion.Current, null));
this.bdpUpdateCommand1.Parameters.Add(new Borland.Data.Common.BdpParameter("age", Borland.Data.Common.BdpType.Int32, Borland.Data.Common.BdpType.Unknown, 0, System.Data.ParameterDirection.Input, false, ((byte)(10)), ((byte)(0)), "age", System.Data.DataRowVersion.Current, null));
this.bdpUpdateCommand1.Parameters.Add(new Borland.Data.Common.BdpParameter("salary", Borland.Data.Common.BdpType.Int32, Borland.Data.Common.BdpType.Unknown, 0, System.Data.ParameterDirection.Input, false, ((byte)(10)), ((byte)(0)), "salary", System.Data.DataRowVersion.Current, null));
this.bdpUpdateCommand1.Parameters.Add(new Borland.Data.Common.BdpParameter("department", Borland.Data.Common.BdpType.String, Borland.Data.Common.BdpType.Unknown, 0, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "department", System.Data.DataRowVersion.Current, null));
this.bdpUpdateCommand1.Parameters.Add(new Borland.Data.Common.BdpParameter("id", Borland.Data.Common.BdpType.String, Borland.Data.Common.BdpType.Unknown, 0, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "id", System.Data.DataRowVersion.Current, null));
this.bdpUpdateCommand1.Parameters.Add(new Borland.Data.Common.BdpParameter("nameOriginal", Borland.Data.Common.BdpType.String, Borland.Data.Common.BdpType.Unknown, 0, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "name", System.Data.DataRowVersion.Current, null));
this.bdpUpdateCommand1.Parameters.Add(new Borland.Data.Common.BdpParameter("ageOriginal", Borland.Data.Common.BdpType.Int32, Borland.Data.Common.BdpType.Unknown, 0, System.Data.ParameterDirection.Input, false, ((byte)(10)), ((byte)(0)), "age", System.Data.DataRowVersion.Current, null));
this.bdpUpdateCommand1.Parameters.Add(new Borland.Data.Common.BdpParameter("salaryOriginal", Borland.Data.Common.BdpType.Int32, Borland.Data.Common.BdpType.Unknown, 0, System.Data.ParameterDirection.Input, false, ((byte)(10)), ((byte)(0)), "salary", System.Data.DataRowVersion.Current, null));
this.bdpUpdateCommand1.Parameters.Add(new Borland.Data.Common.BdpParameter("departmentOriginal", Borland.Data.Common.BdpType.String, Borland.Data.Common.BdpType.Unknown, 0, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "department", System.Data.DataRowVersion.Current, null));
this.bdpUpdateCommand1.Parameters.Add(new Borland.Data.Common.BdpParameter("idOriginal", Borland.Data.Common.BdpType.String, Borland.Data.Common.BdpType.Unknown, 0, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "id", System.Data.DataRowVersion.Current, null));
this.bdpUpdateCommand1.SchemaName = null;
this.bdpUpdateCommand1.Transaction = null;
this.bdpUpdateCommand1.UpdatedRowSource = System.Data.UpdateRowSource.None;
this.Load += new System.EventHandler(this.Page_Load);
this.DataBinding += new System.EventHandler(this.Page_Load);
((System.ComponentModel.ISupportInitialize)(this.bdpDataAdapter1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.dataSet1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.dataTable1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.Table2)).EndInit();
}
#endregion
}
}

<%@ Page language="c#" Debug="true" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false" Inherits="WebApplication5.WebForm1" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title></title>
<meta name="GENERATOR" content="Borland ASP.NET Designer for c# Package Library 7.1">
</head>
<body ms_positioning="GridLayout">
<form runat="server">
<asp:datagrid id=dataGrid1 style="POSITION: absolute" runat="server"
height="170px" datasource="<%# dataSet1 %>"
datamember="Table2" borderstyle="None" gridlines="Vertical"
borderwidth="1px" bordercolor="#999999" backcolor="White"
cellpadding="3" width="519px">
<footerstyle forecolor="Black" backcolor="#CCCCCC">
</footerstyle>
<headerstyle font-bold="True" forecolor="White" backcolor="#000084">
</headerstyle>
<pagerstyle horizontalalign="Center" forecolor="Black"
backcolor="#999999" mode="NumericPages">
</pagerstyle>
<selecteditemstyle font-bold="True" forecolor="White"
backcolor="#008A8C">
</selecteditemstyle>
<alternatingitemstyle backcolor="Gainsboro">
</alternatingitemstyle>
<itemstyle forecolor="Black" backcolor="#EEEEEE">
</itemstyle>
</asp:datagrid>
</form>
</body>
</html>


 
已解决,应用程序池不能选DEFAULT
 
已解决,应用程序池不能选DEFAULT,给HOTBOYS加50分.
happy new year!!!
 
多人接受答案了。
 

Similar threads

S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
I
回复
0
查看
914
import
I
S
回复
0
查看
819
SUNSTONE的Delphi笔记
S
顶部