Welcome to the CodeSmith Community!

New User: Want to create DAL using Codesmith

Support Forums

Feel free to ask any questions about CodeSmith here.

New User: Want to create DAL using Codesmith

Answered (Verified) This question is answered

I have a need to create the DAL & BLL for my project.  I used the BusinessObjectTemplate PLINQO=>  (Database -> Other ->CSharp ->BusinessObject ) to create the BLL

I need to create the DAL. I need a template that create something like the following: Can you suggest a template?

public static class CategoryDB
    private static string GetConnectionString()
        return ConfigurationManager.ConnectionStrings    ["HalloweenConnectionString"].ConnectionString;

    public static int InsertCategory(Category category)
        SqlConnection con = new SqlConnection(GetConnectionString());
        string ins = "INSERT INTO Categories "
            + " (CategoryID, ShortName, LongName) "
            + " VALUES(@CategoryID, @ShortName, @LongName)";
        SqlCommand cmd = new SqlCommand(ins, con);
        cmd.Parameters.AddWithValue("CategoryID", category.CategoryID);
        int i = cmd.ExecuteNonQuery();
        return i;

    public static int DeleteCategory(Category category)

    public static int UpdateCategory(Category original_Category,
        Category category)


  • Post Points: 35
Verified Answer
All Replies
Page 1 of 1 (4 items)