Ho questo script che precendentemente era fatto per funzionare con un db di sql server e una store procedure, io per le mie esigenze dovrei convertirlo per leggere da un db di access; mcio ho provato, ma mi da errori e mi sta facendo impazzire...chi mi sa aiutare...grazie.....
codice:
using System;
using System.Data;
using System.Data.SqlClient;
//using System.Data.SqlTypes;
using System.Data.OleDb;
namespace tntgiallo.it
{
/// <summary>
/// Summary description for CDalAddress.
/// </summary>
public class CDalAddress
{
string strConStr;
string strError;
//SqlConnection oConn;
OleDbConnection oConn;
public string strConnection
{
get
{
return strConStr;
}
set
{
strConStr = value;
try
{
//this.oConn = new SqlConnection(value);
oConn = new OleDbConnection(value);
}
catch (Exception e)
{
throw e;
}
}
}
public SqlDataReader getAll()
{
string strSQL = "";
//SqlCommand oCmd = new SqlCommand(strSQL, oConn);
OleDbCommand oCmd = new OleDbCommand(strSQL, oConn);
oCmd.CommandType = CommandType.Text;
try
{
if (oConn.State == ConnectionState.Closed)
{
oConn.Open();
}
return oCmd.ExecuteReader()
}
catch (Exception e)
{
throw e;
}
}
}
}