Note that there are some explanatory texts on larger screens.

plurals
  1. POEditing remote MS Access Database with Devexpress
    text
    copied!<p>What am I doing wrong here? I am trying to display data from a remote database and inserting,editing, and deleting data. The database that I am connecting to is a remote which I was successfully able to connect and view the information however when I insert the syntax to edit the data I get an error (see bottom of the post). I am using Devexpress Scheduler Controller to view appointments as well edit them.<br> This is the entire code.</p> <pre><code>public partial class MainWindow : Window { CarsDBDataSet dataSet; public MainWindow() { InitializeComponent(); intSchedular(); } private void intSchedular() { schudlerControl1.Storage.AppointmentStorage.Mappings.AllDay = "AllDay"; schudlerControl1.Storage.AppointmentStorage.Mappings.Description = "Description"; schudlerControl1.Storage.AppointmentStorage.Mappings.End = "EndTime"; schudlerControl1.Storage.AppointmentStorage.Mappings.Label = "Label"; schudlerControl1.Storage.AppointmentStorage.Mappings.Start = "StartTime"; schudlerControl1.Storage.AppointmentStorage.Mappings.Location = "Location"; schudlerControl1.Storage.AppointmentStorage.Mappings.ReminderInfo = "RemindderInfo"; schudlerControl1.Storage.AppointmentStorage.Mappings.Subject = "Subject"; schudlerControl1.Storage.AppointmentStorage.Mappings.Status = "Status"; schudlerControl1.Storage.AppointmentStorage.Mappings.Type = "EventType"; schudlerControl1.Storage.AppointmentStorage.Mappings.RecurrenceInfo = "RecurrenceInfo"; System.Data.OleDb.OleDbConnection con = new System.Data.OleDb.OleDbConnection() { ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;" + @"Data source= \\UNDERFOOT-PC\CalUnderFootDB\CarsDB.mdb" }; con.Open(); OleDbCommand createCommand = new OleDbCommand("select * from CarScheduling", con); createCommand.ExecuteNonQuery(); OleDbDataAdapter adapter = new OleDbDataAdapter(createCommand); CarsDBDataSet dataSet = new CarsDBDataSet(); // Bind the scheduler storage to appointment data. schudlerControl1.Storage.AppointmentStorage.DataSource = dataSet.CarScheduling; // Load data into the 'CarsDBDataSet.CarScheduling' table. adapter.Fill(dataSet.CarScheduling); schudlerControl1.Storage.AppointmentsInserted += new PersistentObjectsEventHandler(Storage_AppointmentsModified); schudlerControl1.Storage.AppointmentsChanged += new PersistentObjectsEventHandler(Storage_AppointmentsModified); schudlerControl1.Storage.AppointmentsDeleted += new PersistentObjectsEventHandler(Storage_AppointmentsModified); adapter.Adapter.RowUpdated += new System.Data.OleDb.OleDbRowUpdatedEventHandler(adapter_RowUpdated); } void Storage_AppointmentsModified(object sender, PersistentObjectsEventArgs e) { adapter.Adapter.Update(dataSet); this.dataSet.AcceptChanges(); } private void adapter_RowUpdated(object sender, System.Data.OleDb.OleDbRowUpdatedEventArgs e) { if (e.Status == UpdateStatus.Continue &amp;&amp; e.StatementType == StatementType.Insert) { int id = 0; using (OleDbCommand cmd = new OleDbCommand("SELECT @@IDENTITY", adapter.Connection)) { id = (int)cmd.ExecuteScalar(); } e.Row["ID"] = id; } } } </code></pre> <p>The error I am getting is from the word adapter from "void Storage_AppointmentsModified" saying "the name 'adapter' does not exist in the current context". I know I have to define adapter but how? I am new to C# so I am not "fluent" with writing C# syntax. </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload