The Structured Query Language |
|
|
The Structured Query Language, known as SQL, is a
universal language used on various computer systems to create and manage databases.
|
As a computer language, the SQL is used to give
instructions to an internal program called an interpreter. You must make sure you give precise
instructions. SQL is
not case-sensitive.
If you are creating a web site, you can
write the necessary code. Once your
code is ready, you can pass it to a OleDbCommand object you would have
created. This would be done as follows:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.OleDb;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
using (OleDbConnection connection =
new OleDbConnection("Provider=Microsoft.Jet.OLE.4.0;" +
"Data Source=" + Server.MapPath("App_Data/exercise.mdb")))
{
OleDbCommand CommandToExecute = new OleDbCommand(SQL Code, connection);
}
}
}
In this example, the SQL Code factor represents
a SQL statement you would write and pass it as a string.
After passing the
SQL code to a command, to execute it, you can
call the ExecuteNonQuery() method of your OleDbCommand object. This would be done as follows:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.OleDb;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
using (OleDbConnection connection =
new OleDbConnection("Provider=Microsoft.Jet.OLE.4.0;" +
"Data Source=" + Server.MapPath("App_Data/exercise.mdb")))
{
OleDbCommand command = new OleDbCommand(SQL Code, connection);
connection.Open();
command.ExecuteNonQuery();
}
}
}