I'm trying to compile some code in Visual C# Express.
Would someone please have a gander and help me out by giving me a brife explanation of why I'm getting an error "oleDbDataAdapter is not in the current context"?

From my understanding (which must be wrong) oleDbDataAdapter is part of System.Data.Oledb context.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Data.OleDb;

namespace WindowsFormsApplication1
    public partial class formProcessor : Form
        public formProcessor()

        private void Form1_Load(object sender, EventArgs e)
// Put all file names in root directory into array.
            string[] array1 = Directory.GetFiles(@"C:\documents and settings\All Users\Documents\IGRT\", "*.jpg");  
// Connect to mdb
            string connetionString = null;
            System.Data.OleDb.OleDbConnection cnn;
            connetionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\\Documents and Settings\\All Users\\Documents\\IGRT\\shifts.mdb;";
            cnn = new System.Data.OleDb.OleDbConnection(connetionString);
                MessageBox.Show("Connection Open ! ");
                MessageBox.Show("Can not open connection ! ");

 //increment for softName           
            int x = 0;       
            foreach (string name in array1)
                string sql = "SELECT * FROM ShiftTable WHERE imgName = \'"+(name)+"\'";
                oleDbDataAdapter.SelectCommand.CommandText;  //getting error message here

I don't see anywhere in your code that you declare the variable oleDbDataAdapter, which is what the error is telling you.

This question has already been answered. Start a new discussion instead.