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
Erdinc Kolukisa
NA
113
0
need critics about coding technique
Dec 17 2010 8:38 AM
hey guys..i need some professional friends critics about the coding i made in my small project...when i want to select one row data from my project i coded like that..in my DataAccess layer
public
SqlDataAdapter
FirmaDetails(
string
gelenFirma)
{
cmd =
new
SqlCommand
(
"sp_FirmaDetails"
, con);
cmd.CommandType =
CommandType
.StoredProcedure;
cmd.Parameters.AddWithValue(
"@gelen_firma"
, System.Data.
SqlDbType
.NVarChar).Value = gelenFirma;
da =
new
SqlDataAdapter
(cmd);
return
da;
}
and then in my Helper class
public
DataTable
FirmaDetails(
string
gelenFirma)
{
da = d.FirmaDetails(gelenFirma);
da.Fill(dt);
return
dt;
}
then to get the datas inside of my form
private
void
DetayForm_Load(
object
sender,
EventArgs
e)
{
dt =
new
DataTable
();
dt = helpr.FirmaDetails(textBox1.Text);
for
(
int
i=0; i < dt.Rows.Count; i++)
{
lblYetkili.Text = dt.Rows[i][0].ToString();
lblGsm.Text = dt.Rows[i][1].ToString();
lblEmail.Text = dt.Rows[i][2].ToString();
lblYetkili2.Text = dt.Rows[i][3].ToString();
lblGsm2.Text = dt.Rows[i][4].ToString();
lblEmail2.Text = dt.Rows[i][5].ToString();
lblYetkili3.Text = dt.Rows[i][6].ToString();
lblGsm3.Text = dt.Rows[i][7].ToString();
lblEmail3.Text = dt.Rows[i][8].ToString();
}
}
now i wonder if it is too rookie technique(actually i am already) if it is how i can improve in better way..should i use SqlDataReader..thanks for your advices
Reply
Answers (
2
)
Multiple checkboxes C#
What's wrong with this SQL statement| Thanks