Get and retrive data using n-tire asp.net
hi everybody i have made n tire to make insert , update , select and delete
insert and delete works fine but i have problem to make select all data in order to make update
this is a method in db.class where connection can be perform
public void ConnectDB(CommandType CT,string ProNameSQl)
{
cn = new SqlConnection("Data Source=.;Initial Catalog=Conversation;Integrated Security=True");
cmd = new SqlCommand();
cmd.Connection = cn;
cmd.CommandType = CT;
cmd.CommandText = ProNameSQl;
cn.Open();
}
public int RunProcedure(string ProcedureName, SortedList Paraval)
{
ConnectDB(CommandType.StoredProcedure, ProcedureName);
for (int x = 0; x < Paraval.Count; x++)
{
try
{
cmd.Parameters.AddWithValue(Paraval.GetKey(x).ToString(), Paraval.GetByIndex(x));
}
catch
{
;
}
}
return ExceNoneQuery();
}
public DataTable RunSQl(string Select)
{
ConnectDB(CommandType.Text, Select);
dt=new DataTable();
dt.Load(cmd.ExecuteReader());
cn.Close();
return dt;
}
and then after check i make another class to pass the type of operation "i" refers to procdure name in sql
public bool Add()
{
return LoadProperties2List("i");
}
if every thing ok it runs to the last tire where the code can perform like insert
public class UsersInfo :MainTable
{
#region Feild
private string _id;
private string _username;
private string _SecondarySchool;
private string _University;
#endregion
#region Properties
public string id
{
get
{
return _id;
}
set
{
_id = value;
}
}
public string UserName
{
get
{
return _username;
}
set
{
_username = value;
}
}
public string SecondarySchool
{
get
{
return _SecondarySchool;
}
set
{
_SecondarySchool = value;
}
}
public string University
{
get
{
return _University;
}
set
{
_University = value;
}
}
#endregion
public override bool LoadProperties2List(string TypeOfOperation)
{
SortedList Sl = new SortedList();
Sl.Add("@CommandType", TypeOfOperation);
Sl.Add("@UserName",UserName);
Sl.Add("@SecondarySchool",SecondarySchool);
Sl.Add("@University",University);
ProcedureName = "MangeUserInfo";
if (db.RunProcedure(ProcedureName, Sl) == 1)
return true;
else
return false;
}
public bool Register(string User, string SecondaryS, string Unvi)
{
this.UserName = User;
this.SecondarySchool = SecondaryS;
this.University = Unvi;
if (Add())
return true;
else
return false;
}
this code works fine how to use these layers to sellect and retrive database and show them in textboxes ??? using the same layers