.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Code Snippets >> ADO.NET >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

Data Access Layer-- PART-1

Posted By:BangaruBabuPureti       Posted Date: May 13, 2010    Points: 10    Category: ADO.NET    URL: http://www.dotnetspark.com  

Hi I Developed Data Access Layer(DAL) By Utilizing SQL-Helper Class.It is Easy To Write and Organize Business Access Layer(BAL) very effectively.I am Going To Post This DAL in Three PARTS--This Is PART-1 of the Series
 



public static void CacheParameterSet(string commandText, params  
SqlParameter[] objparams)
{
    SqlHelperParameterCache.CacheParameterSet(getConnection(), commandText,  
objparams);
}
------------------------


public static SqlDataReader ExecuteDataReader(string strSelect)
{
    SqlDataReader reader;
    try
    {
        reader = SqlHelper.ExecuteReader(getConnection(), CommandType.Text,  
strSelect);
    }
    catch (SqlException exception)
    {
        throw exception;
    }
    catch (Exception exception2)
    {
        throw exception2;
    }
    return reader;
}

--------------

public static DataSet ExecuteDataset(string strSelect)
{
    DataSet set;
    try
    {
        set = SqlHelper.ExecuteDataset(getConnection(), CommandType.Text, strSelect);
    }
    catch(SqlException exception)
    {
        throw exception;
    }
    catch (Exception exception2)
    {
        throw exception2;
    }
    return set;
}


     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend