Web Service Error

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: James (jamesgurung_at_hotmail.com)
Date: 02/01/04


Date: Sun, 1 Feb 2004 05:01:07 -0800

I'm trying to get a web service (with C#) to access a remote database, and provide a connection between the data (MS Access .mdb database) and a Windows client. At present I am running it all on localhost. However, I receive the error:

System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.InvalidOperationException: The ConnectionString property has not been initialised.
at Ststem.Data.OleDb.OleDbConnection.Open()
at .....

What could the problem be?

I have two web methods called consecutively, as follows:

[WebMethod]
public void SupplyDatabasePassword(string Password) {
  Password.Trim(); Password.ToLower(); if (Password.LastIndexOf(';') > -1) return;
  this.oleDbConnection1.ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0; Jet OLEDB:Database Password=" + Password + @"; Data source=" + Server.MapPath("TMIData.mdb") +@"; User ID=Admin; Password=; Persist Security Info=true";
    }

[WebMethod]
public bool VerifyDBAccess() {
  //try {
    oleDbConnection1.Open();
    return true;
  //} catch {
  // return false;
  //};
}

First, my Windows application specifies the password, and then it verifies the database by attempting to open it.

Do I have to set the connectionstring and open in the same method? If so, is there a way around this?

Please help, and thanks in advance!

James



Relevant Pages

  • Re: One Web Service updates SQL, another cant?
    ... I guess its because this is my first Web Service and I ... it opens the database connection. ... > Columnist, SQL Server Professional ...
    (microsoft.public.sqlserver.security)
  • Re: REPOST: One Web Service updates SQL, the other cant
    ... One Web Service can access and update the database via ADO ... > possible using the following connection string: ... > Columnist, SQL Server Professional ...
    (microsoft.public.vb.database.ado)
  • Jet database access problem from web service
    ... I have trouble connecting to Access database from my web service. ... permissions into the directory where database is located; ... I also tried an Odbc connection with with the follwoing string: ...
    (microsoft.public.dotnet.framework.aspnet)
  • Connecting to Access through Ado in Web service
    ... database through TAdoConnection in a D7 web service. ... We tried setting the connection strings datasource property ... tested it at design time and it fails. ... We have also tried setting the database path in network format, ...
    (borland.public.delphi.database.ado)
  • Re: updating tables from disconnected dataset
    ... This must be terribly obvious or terribly obscure. ... Is it, in fact, the 'normal' way for a client with no database connection to ... think this undesirable when dealing with a web service. ...
    (microsoft.public.dotnet.framework.adonet)