NEXT CHAPTER 25 Coding Details and Code Efficiency
Code Details
DBMgt.
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient ;
/// <summary>
/// Summary description for DBMgt
/// </summary>
public class DBMgt
{
public DBMgt()
{
}
public SqlConnection con=new SqlConnection("Server=.;uid=sa;pwd=;integrated security=true;database=OnLEDB");
SqlDataAdapter adpt;
DataSet dtst;
SqlCommand cmd;
private string strDel;
public void OpenCon()
{
if(con.State==ConnectionState.Closed)
con.Open();
else
{
con.Close();
con.Open();
}
}
public void CloseCon()
{
if(con.State==ConnectionState.Open)
con.Close();
}
public bool ExecuteNonQueryStoreProc(string StrProcName, SqlParameter[] parList)
{
SqlCommand cmd = new SqlCommand(StrProcName, con);
cmd.CommandType = CommandType.StoredProcedure;
for (int inc = 0; inc < parList.Length; inc++)
cmd.Parameters.Add(parList[inc]);
OpenCon();
int i = cmd.ExecuteNonQuery();
CloseCon();
if (i == 1)
return true;
else
return false;
}
public SqlCommand ExecuteReaderStoreProc(string StrProcName, SqlParameter[] parList)
{
SqlCommand cmd = new SqlCommand(StrProcName, con);
cmd.CommandType = CommandType.StoredProcedure;
for (int inc = 0; inc < parList.Length; inc++)
cmd.Parameters.Add(parList[inc]);
OpenCon();
cmd.ExecuteReader();
CloseCon();
return cmd;
}
public object ExecuteScalerStoreProc(string StrProcName, SqlParameter[] parList)
{
SqlCommand cmd = new SqlCommand(StrProcName, con);
cmd.CommandType = CommandType.StoredProcedure;
for (int inc = 0; inc < parList.Length; inc++)
cmd.Parameters.Add(parList[inc]);
OpenCon();
object obj = cmd.ExecuteScalar();
CloseCon();
return obj;
}
}
This site is designed to help BCA MCA student to develop final project and synopsis Download Free BCA Project, MCA Project, IT Projects, Final report and Project synopsis with Full documentation and code
free download MCA projects in ASP.NET with complete source code, Free download MCA projects in VB,NET with complete source code, Free download MCA MSc projects in C#.net with complete source code,
Free download MCA projects in JAVA with complete source code, Free download MCA projects in PHP with complete source code, Free download BSc CS IT projects in PHP,JAVA, ASP.NET with source code
Computer Science Final Project , Free download MCA projects in asp.net , Free download MCA projects in vb.net, Free download MCA projects in C#.net, Free download MCA projects in java, Free download MCA projects in PHP