Click here to Skip to main content
15,886,067 members
Articles / Database Development / SQL Server

DAL Class and Transact-SQL Generator for C# and VB.NET

Rate me:
Please Sign up or sign in to vote.
4.48/5 (27 votes)
8 Dec 2007CPOL2 min read 133K   13.7K   96  
Automatically generates the required class and stored procedure to work with SQL databases
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Windows.Forms;

namespace SUNCodeGenerator.Classes
{
    class File
    {
        public void Save(string Name, string Path, string info, string pasvand)
        {
            if (System.IO.File.Exists(Path + "\\" + Name + "." + pasvand))
            {
                if (MessageBox.Show("This File Is Already Exist...\nAre You Want Replace This File?", "File", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Cancel)
                {
                    return;
                }
                else
                {
                    System.IO.File.Delete(Path + "\\" + Name + "." + pasvand);
                }
            }

            FileStream f = new FileStream(Path + "\\" + Name + "." + pasvand, FileMode.CreateNew, FileAccess.Write);
            StreamWriter fso = new StreamWriter(f);
            fso.Write(info);
            fso.Close();
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Web Developer
Iran (Islamic Republic of) Iran (Islamic Republic of)
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions