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
anh hoang
NA
3
1.3k
TabControl with procedures (SqlServer)!
Dec 7 2011 8:40 PM
Hi everybody!
I am Winform (C#) beginer. I have a problem. My project use 3 layers include DA, GUI, BL. GUI has frm_Main. I use TabControl in this one. In Tabcontrol i has dataGridView1. In BL i wrote
public
void
HienThi(
string
Employ_ID ,
string
Employ_Name,
string
Employ_Birth)
{
connection.Open();
SqlCommand
cmd =
new
SqlCommand
();
cmd.Connection = connection.GetConnection;
cmd.CommandText =
"[dbo].[InFO]"
;
cmd.CommandType = System.Data.
CommandType
.StoredProcedure;
SqlParameter
[]pl =
new
SqlParameter
[3];
if
(Employ_ID !=
null
|| Employ_Name!=
null
|| Employ_Birth!=
null
)
{
pl[0] =
new
SqlParameter
(
"@MaNV"
, MaNV);
pl[1] =
new
SqlParameter
(
"@TenNV"
, TenNV);
pl[2] =
new
SqlParameter
(
"@NgaySinh"
, NgaySinh);
}
else
{
pl[0] =
new
SqlParameter
(
"@MaNV"
,
DBNull
.Value);
pl[1] =
new
SqlParameter
(
"@TenNV"
,
DBNull
.Value);
pl[2] =
new
SqlParameter
(
"@NgaySinh"
,
DBNull
.Value);
}
cmd.Parameters.AddRange(pl);
SqlDataAdapter
adp =
new
SqlDataAdapter
(cmd);
DataTable
tb =
new
DataTable
();
((DataGridView)frm.Controls["dataGridView1"]).DataSource = tb; //
error in here
connection.Close();
}
CAN YOU: fix this code
((DataGridView)frm.Controls["dataGridView1"]).DataSource = tb;
Thanks!
Reply
Answers (
3
)
Only total fields with date value overdue
How to convert currency values while select the amount using Sql Server