Most of the software development cases we face daily is addressed with certain technology. For example, if the application is developed in PHP, the database is MySQL or if it is Microsoft.Net then most probably it is MsSQL Server.
likewise, you can have your own methods to support for your data layer. Try it and it's worth. And the performance is also impressive.
We will discuss a bit more about ingres data access in our future posts. Until that, happy coding.. :)
What if we need to make a difference or the business case is not the common way we practice? For instance, a certain company may find Microsoft development platform with a separate database provider. As an example, the application can be implemented in C# and Database could be Ingres.
Lets get in to business. What we need is to download the ingres database from here and the .Net connector from here.
Make sure you register your ingres client in your project.
And the following classes will do the needful if you use it correctly for database operations.
IngresConnection for DB Connection
IngresTransaction for Transaction management
IngresDataReader for data reading
IngresParameterCollection for parameters
IngresCommand for DB Commands
The use of above classes as follows,
IngresConnection Connection = new IngresConnection("your connection string here");
And the below will return a data reader object.
public IngresDataReader ExecuteQuery(string sql, IngresParameterCollection parameters)
{
IngresCommand ingresCommand = null;
try
{
if (this.Connection.State != ConnectionState.Open)
this.Connection.Open();
ingresCommand = new IngresCommand(sql, this.Connection);
ingresCommand.CommandType = CommandType.Text;
ingresCommand.CommandTimeout = 0;
if (parameters != null)
{
foreach (IngresParameter parameter in parameters)
{
ingresCommand.Parameters.Add(parameter);
}
}
IngresDataReader ingresDataReader = ingresCommand.ExecuteReader(CommandBehavior.CloseConnection);
return ingresDataReader;
}
catch
{
throw;
}
finally
{
if (ingresCommand != null)
ingresCommand.Dispose();
}
}
likewise, you can have your own methods to support for your data layer. Try it and it's worth. And the performance is also impressive.
We will discuss a bit more about ingres data access in our future posts. Until that, happy coding.. :)
No comments:
Post a Comment