TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
elham deljooei
NA
84
73.5k
How to get a row from Sqldatareader in 3-tier?
Jul 31 2013 5:25 AM
Hi everyone
I've had a problem. I want to know how to get a row from sqldatareader in 3-tier?
My code don't run. Could you tell me Why it isn't correct ?
this is my code:
DAL:
public static SqlDataReader Clerk_Search(string name, string family, string melliCode)
{
SqlDataReader sqlDataReader;
SqlCommand comm = new SqlCommand("Clerk_Search", Data_Access.conn);
comm.CommandType = CommandType.StoredProcedure;
comm.Parameters.AddWithValue("@clk_Name", name);
comm.Parameters.AddWithValue("@clk_Family", family);
comm.Parameters.AddWithValue("@clk_MeliCod", melliCode);
conn.Open();
sqlDataReader = comm.ExecuteReader();
conn.Close();
return sqlDataReader;
}
BL:
static public System.Data.SqlClient.SqlDataReader Clerk_Search(string name, string family, string meliCode)
{
System.Data.SqlClient.SqlDataReader sqlDataReader;
sqlDataReader = Data_Access.Clerk_Search(name, family, meliCode);
return sqlDataReader;
}
UI
private void Clerk_Search_Click(object sender, EventArgs e)
{
//System.Data.SqlClient.SqlDataReader sqlDataReader;
System.Data.SqlClient.SqlDataReader red;
red = Business.Clerk_Search(txtNameClerk.Text.Trim(), txtFamilyClerk.Text.Trim(), txtShomarehyeMeliClerk.Text.Trim());
txtClerkId.Text = red["clk_Id"].ToString();
}
Reply
Answers (
9
)
Session Management
how to download and install fxcop to codereview