This project is read-only.
using SmartLibraries.DataAccessLayer
//Select The Records - DataTable
using (ISmartQuery Procedure = new SmartStoredProcedure(ClsDALUtilities.GetConnectionString()))
{
Procedure.Query = "SprSelectAccountsByType";
SmartDbParameters Parameters = new SmartDbParameters();

Parameters.Add(new SmartDbParameter("@AccountType", objAccountType));
Procedure.Parameters = Parameters;
return (Procedure.GetDataTable());
}
-----------------------------------------------------------
//Select The Record - Single Row
using (ISmartQuery Procedure = new SmartStoredProcedure(ClsDALUtilities.GetConnectionString()))
{
Procedure.Query = "SprSelectAccountByNumber";
SmartDbParameters Parameters = new SmartDbParameters();

Parameters.Add(new SmartDbParameter("@AccountNumber", objAccountNumber));
Procedure.Parameters = Parameters;
return (Procedure.GetSingleRow());
}
---------------------------------------------------------------------
//Insert/Update the record
using (ISmartQuery Procedure =
new SmartStoredProcedure(ClsDALUtilities.GetConnectionString()))
{
Procedure.Query = "SprInsertCustomer";
SmartDbParameters Parameters = new SmartDbParameters();


Parameters.Add(new SmartDbParameter("@CstomerName", "Sukesh"));


Procedure.Parameters = Parameters;
Procedure.ExecuteNonQuery();

}

//Use SmartSqlQuery just inplace of SmartStoredProcedure if want to execute query instead of stored procedure
//Use SmartOledbQuery and SmartOledbStoredProcedure For OLEDB
------------------------------------------------------------------------------------------------------

OLEDB Sample

using(ISmartQuery p = new SmartOledbQuery("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=\"G:\\CDRIVE\\My Documents\\MYDB.accdb\""))
{
string s = p.Query;
p.Query = @"Insert Into Student(Roll) values(@Roll)";
p.Parameters = new SmartDbParameters();
p.Parameters.Add(new SmartDbParameter("@Roll", sss));
p.ExecuteNonQuery();
}

Last edited Oct 1, 2012 at 10:42 AM by SukeshMarla, version 6

Comments

No comments yet.