Errors when accessing data from a webservice

Tech-Archive recommends: Speed Up your PC by fixing your registry

From: Stephen Livesey (msdn_at_exact3ex_removethis.co.uk)
Date: 02/20/04


Date: Fri, 20 Feb 2004 09:34:49 -0000

Hi,

I am having a problem developing a web service that is accessing data using
OLE or ODBC, however this problem is only occurring on 1 development PC
(mine), I have tested the same web service on other PC's and it works fine.
I have also written applications that use the same data providers and
perform the same queries, these applications work perfectly, I only get the
problem when using web services.

To test the problem, I have created new web service, this web service has
two methods, one using ODBC and the other using OLE, both methods perform
the same simple query as follows:

[WebMethod]
public DataSet GetDataSetUsingOdbc()
{
    DataSet dataSet = new DataSet();
    OdbcConnection odbcConnection = new
OdbcConnection("DSN=Temp5;UID=;NODE=;APPLICATION=");
    OdbcDataAdapter odbcDataAdapter = new OdbcDataAdapter("select * from
expppgi",odbcConnection);
    odbcDataAdapter.Fill(dataSet,"Table");
    odbcConnection.Close();
    if (dataSet != null)
    {
        return dataSet;
    }
    return null;
}

[WebMethod]
public DataSet GetDataSetUsingOle()
{
    DataSet dataSet = new DataSet();
    OleDbConnection oleDbConnection = new
OleDbConnection("Provider=CONNXOLEDB.1;Mode=ReadWrite;User ID=ste;Data
Source=c:\\connx32\\cdds\\temp5.cdd;Extended Properties=;Persist Security
Info=False;Location=");
    OleDbDataAdapter oleDbDataAdapter = new OleDbDataAdapter("select * from
expppgi",oleDbConnection);
    oleDbDataAdapter.Fill(dataSet,"Table");
    oleDbConnection.Close();
    if (dataSet != null)
    {
        return dataSet;
    }
    return null;
}

When I execute the Web Service and use the OLE method, the following error
is produced:

System.Data.OleDb.OleDbException: No error information available:
E_UNEXPECTED(0x8000FFFF). at
System.Data.OleDb.OleDbConnection.ProcessResults(Int32 hr) at
System.Data.OleDb.OleDbConnection.InitializeProvider() at
System.Data.OleDb.OleDbConnection.Open() at
System.Data.Common.DbDataAdapter.QuietOpen(IDbConnection connection,
ConnectionState& originalState) at
System.Data.Common.DbDataAdapter.FillFromCommand(Object data, Int32
startRecord, Int32 maxRecords, String srcTable, IDbCommand command,
CommandBehavior behavior) at System.Data.Common.DbDataAdapter.Fill(DataSet
dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand
command, CommandBehavior behavior) at
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable) at
ConnxTest.Service1.GetDataSetUsingOle() in
c:\inetpub\wwwroot\connxtest\service1.asmx.cs:line 80When I execute the Web
Service and use the ODBC method, the following error is produced:

System.NullReferenceException: Object reference not set to an instance of an
object. at System.Data.Common.Odbc32.SQLFreeHandle(Int16 HandleType,
HandleRef StatementHandle) at
System.Data.Odbc.DBCWrapper.CloseAndRelease() at
System.Data.Odbc.OdbcConnection.DisposeClose() at
System.Data.Odbc.OdbcConnection.Open() at
System.Data.Common.DbDataAdapter.QuietOpen(IDbConnection connection,
ConnectionState& originalState) at
System.Data.Common.DbDataAdapter.FillFromCommand(Object data, Int32
startRecord, Int32 maxRecords, String srcTable, IDbCommand command,
CommandBehavior behavior) at System.Data.Common.DbDataAdapter.Fill(DataSet
dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand
command, CommandBehavior behavior) at
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable) at
ConnxTest.Service1.GetDataSetUsingOdbc() in
c:\inetpub\wwwroot\connxtest\service1.asmx.cs:line 60
Both of the errors occur when the Fill command is being executed.

The PC is using Visual Studio 2003 and Windows XP Professional, I have also
installed MDAC v2.8 but this had no effect.

Thanks

Stephen Livesey



Relevant Pages

  • Re: writing/publishing/consuming
    ... \par "Whether it will generated cs file or dll" is not important for the two approaches as both of them can generate dll and cs file. ... Is there an advantage to using the command line? ... \par> and after writing a web service to convert temperatures between ... \par> Generating a proxy class of the service. ...
    (microsoft.public.dotnet.framework.webservices)
  • Re: writing/publishing/consuming
    ... "Whether it will generated cs file or dll" is not important for the two approaches as both of them can generate dll and cs file. ... ** In Visual Studio, the visual approach is integrated with IDE and as long as you use VS to generate the webservice proxy, IDE will help you do a lot of things(such as call the command with parameters get from your GUI input). ... Also, when you want to update a proxy, you can simply right click it to update. ... and after writing a web service to convert temperatures between ...
    (microsoft.public.dotnet.framework.webservices)
  • Re: writing/publishing/consuming
    ... Out of curiosity why does it seem the command line method wants to create a .cs file and the visual approach seems to create a .dll file? ... and after writing a web service to convert temperatures between ... Generating a proxy class of the service. ... have used VS.NET command prompt for this example.), ...
    (microsoft.public.dotnet.framework.webservices)
  • Data adapter bug?
    ... We are using a standard data adapter, with a SQL command that works in all ... IDataReader dataReader, Int32 startRecord, Int32 maxRecords) ... DataTabledatatables, Int32 startRecord, Int32 maxRecords, String ...
    (microsoft.public.dotnet.framework)
  • database login failed
    ... to SQL Server. ... startRecord, Int32 maxRecords, String srcTable, IDbCommand command, ... Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior ...
    (microsoft.public.dotnet.framework.aspnet)