the type name 'OleDbConnection' could not be found in the namespacw 'System.Data.OleDb'. This type has been forwarded
זו השגיאה שכתובה לי.
כל ה oleDb מסומנים באדום
יש לציין שיש לי using System.Data.OleDb
אשמח לתשובה.
תודה מראש😘
מצורף כל הקוד של class Dal
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.OleDb;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WinFormsApp1.DAL
{
public class ClassDal
{
private DataSet ds;
private OleDbConnection con;
public ClassDal()
{
ds = new DataSet();
con = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Application.StartupPath + @"\project_shira_b.mdb");
}
public void AddTable(string tableName)
{
OleDbDataAdapter adapter = new OleDbDataAdapter("select * from " + tableName, con);
if (!ds.Tables.Contains(tableName))
adapter.Fill(ds, tableName);
}
public DataTable GetTabel(string tableName)
{
if (!ds.Tables.Contains(tableName))
AddTable(tableName);
return ds.Tables[tableName];
}
public DataTable GetQuery(string sqlString)
{
OleDbDataAdapter adapter = new OleDbDataAdapter(sqlString, con);
DataTable table = new DataTable();
adapter.Fill(table);
return table;
}
public void UpDate(string tableName)
{
OleDbDataAdapter adapter = new OleDbDataAdapter("select * from " + tableName, con);
OleDbCommandBuilder builder = new OleDbCommandBuilder(adapter);
adapter.InsertCommand = builder.GetInsertCommand();
adapter.DeleteCommand = builder.GetDeleteCommand();
adapter.UpdateCommand = builder.GetUpdateCommand();
adapter.Update(ds, tableName);
}
}
}