Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You will also need to have <a href="http://www.microsoft.com/downloads/en/details.aspx?FamilyID=6c050fe3-c795-4b7d-b037-185d0506396c&amp;displaylang=en" rel="nofollow"><code>MDAC</code></a> (Microsoft Data Access Components).</p> <p>In order to help you with the connection string and its parameters for a data file such as an Access database, please follow the following link specific to Access: <a href="http://connectionstrings.com/access" rel="nofollow"><code>Access</code></a>.</p> <p>For other connection strings in general: <a href="http://connectionstrings.com/" rel="nofollow"><code>ConnectionStrings.com</code></a>.</p> <p>In short, you need to specify your complet filename to the Access database file in your connectionString.</p> <pre><code>using (OleDBConnection connection = new OleDBConnection(connectiongString)) { if (connection.State != ConnectionState.Open) connection.Open(); string sql = "INSERT INTO Student (Id, Name) VALUES (@idParameter, @nameParameter)" using (OleDBCommand command = connection.CreateCommand()) { command.CommandText = sql; command.CommandType = CommandType.Text; OleDBParameter idParameter = command.CreateParameter() idParameter.DbType = System.Int32; idParameter.Direction = Parameterdirection.Input; idParameter.Name = "@idParameter"; idParameter.Value = studentId; // Where studentId is an int variable that holds your parsed TextBox.Text property value. OleDBParameter nameParameter = command.CreateParameter() // Do the same as you did above for the nameParameter. try { command.ExecuteNonQuery() } finally { command.Dispose(); connection.Dispose(); } } } </code></pre> <blockquote> <p><strong>Disclaimer</strong> This code is provided as-is as it was not compiled nor tested. That is only to show you the idea of how it works. Further tests might be necessary depending on your project architecture or else.</p> </blockquote>
 

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