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()
        {
            InitializeComponent();
        }

        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);
            try
            {
                cnn.Open();
                MessageBox.Show("Connection Open ! ");
                cnn.Close();
            }
            catch
            {
                MessageBox.Show("Can not open connection ! ");

            }
 //increment for softName           
            int x = 0;       
            foreach (string name in array1)
            {
                x++;
                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.

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.