.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-2

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-2 of the Series
 

public static int ExecuteNonQuery(string strQuery)
{
    int num;
    try
    {
        num = SqlHelper.ExecuteNonQuery(getConnection(), CommandType.Text,  
strQuery);
    }
    catch (SqlException exception)
    {
        throw exception;
    }
    catch (Exception exception2)
    {
        throw exception2;
    }
    return num;
}
--------------

public static int ExecuteNonQuery(SqlTransaction transaction, string  
strQuery)
{
    int num;
    try
    {
        num = SqlHelper.ExecuteNonQuery(transaction, CommandType.Text,  
strQuery);
    }
    catch (SqlException exception)
    {
        throw exception;
    }
    catch (Exception exception2)
    {
        throw exception2;
    }
    return num;
}

 
-----------------
public static object ExecuteScalar(string strQuery)
{
    object obj2;
    try
    {
        obj2 = SqlHelper.ExecuteScalar(getConnection(), CommandType.Text,  
strQuery);
    }
    catch (SqlException exception)
    {
        throw exception;
    }
    catch (Exception exception2)
    {
        throw exception2;
    }
    return obj2;
}

     

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