The line below with nametest in it give out of scope when run. Why? There is
data in the table.
using System;
using System.Data;
using System.Data.OleDb;
namespace DataFM_Access_Data
{
class AccessConv
{
[STAThread]
static void Main()
{
string strAccessConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=mmrs.mdb";
string strAccessSelect = "Select * from Customers";
DataSet myDataSet = new DataSet();
myDataSet.Tables.Add("Customers");
OleDbConnection myAccessConn = new OleDbConnection(strAccessConn);
myAccessConn.Open();
OleDbCommand myAccessDataSetCmd = new
OleDbCommand(strAccessSelect,myAccessConn);
OleDbDataReader dtrAccess = myAccessDataSetCmd.ExecuteReader();
if (dtrAccess.Read())
{
string nameTest= dtrAccess["CompanyName"].ToString();
^gives out of scope?
}
myAccessConn.Close();
}
}
}
}