Hi, I hope I'm in the right place,
I'm not an ASP.NET expert, I'm developing a site where I use MSAccess to data base.
All works well except for a Class, cut and pasted, where I tried to open my access table. I used the same namespace used in all other pages but in this class I can't find the OleDb namespace:

using System.Collections.Generic;
using System.Web.Services;
using System.Data.OleDb;
using System.Data;
using System.Data.Odbc;

[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.Web.Script.Services.ScriptService]

public class AutoComplete : WebService
{
    public AutoComplete()
    {
    }

    [WebMethod]

    public string[] GetCompletionList(string prefixText, int count)
    {
       OleDbConnection Connection = new OleDbConnection(); //THIS SHOULD BE CYAN COLOR
    }
}

there's some namespace visibility limitations for the class?

thanks in advance.

Lenny

Recommended Answers

All 3 Replies

The code looks okay. OleDbConnection lives in System.Data.dll; does your project reference this assembly?

You should add a reference to this namespace also...right click your project, click add reference and find System.Data then click add reference.

commented: Many thanks this solved!. +0

Not sure why this received a downvote?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.