Note that there are some explanatory texts on larger screens.

plurals
  1. POOleDBException was unhandled NO value given for one or more parameters
    primarykey
    data
    text
    <p>I am trying to Update a table in an access database from C#.</p> <p>It is a .mdb type database.</p> <p>here is the connection string I am using. <code>public MainWindow() {</code> </p> <pre><code>InitializeComponent(); OleDbConnection cn= new OleDbConnection();} cn.ConnectionString=@"Provider=Microsoft.Jet.OLEDB.4.0;DataSource=" + "C:\Users\Angela\Documents\Visual Studio 2010\Projects\Havnefoged11.mdb;" + "User Id=;Password=;"; cn.Open(); Application.Current.Properties["DBConnection"] = cn; </code></pre> <p>The file is in the correct folder C:\Users\Angela\Documents\Visual Studio 2010\Projects</p> <pre><code> private void button1_Click_1(object sender, RoutedEventArgs e) { OleDbConnection conn = (OleDbConnection)Application.Current.Properties["DBConnection"]; //Below are the values i want to put into the database String dybde = Dybde.Text; String bredde = Bredde.Text; String plads = PladsNummer.Text; String StrSQL = "INSERT INTO Bådpladser (Plads_nummer,Bredde,Dybde) VALUES (´´"+ plads + "´,´" + bredde + "´," + dybde+");"; OleDbCommand InsertCommand = new OleDbCommand(StrSQL, conn); InsertCommand.ExecuteNonQuery(); } </code></pre> <p>I then get the error OleDBException was unhandled NO value given for one or more parameters</p> <p>I have gone in and changed all the fields in the database to be text I have checked the field names they are correct. The ldb file comes when I initialise the program. but as soon as I press the button I get the error.</p> <p>Any ideas?</p> <p>Ps I have included the </p> <pre><code> using System.Data; using System.Data.OleDb; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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