{
StudentType tStudent = new StudentType();
List
BuildConnstring ();
using (SqlConnection conn = new SqlConnection (connstring))
{
using (SqlCommand Command = conn.CreateCommand ())
{
conn.Open ();
Command.CommandText = "select * from student";
Command.CommandType = CommandType.Text;
dbAdapter.SelectCommand = Command;
ds.Clear ();
ds.DataSetName = "User";
dbAdapter.Fill (ds);
}
}
if (tStudent.adm_no > 0)
{
if (ds.Tables[0].Rows.Count == 1)
{
for (int i = 0; i <= ds.Tables[0].Rows.Count - 1; i++)
{
tStudent = new StudentType();
//tStudent.student_id = Convert.ToInt32 (ds.Tables [0].Rows [i] ["student_id"]);
tStudent.adm_no = Convert.ToInt32 (ds.Tables [0].Rows [i] ["adm_no"]);
tStudent.first_name = ds.Tables [0].Rows [i] ["first_name"].ToString ();
tStudent.last_name = ds.Tables [0].Rows [i] ["last_name"].ToString ();
tStudent.sir_name = ds.Tables [0].Rows [i] ["sir_name"].ToString ();
tStudent.id_no = ds.Tables [0].Rows [i] ["id_no"].ToString ();
tStudent.dob = ds.Tables [0].Rows [i] ["dob"].ToString ();
tStudent.Sex = ds.Tables [0].Rows [i] ["Sex"].ToString ();
student.Add(tStudent);
}
}
}
return student;
}
Carlos kambuiPosted May 7, 2015, 5:14 AM
i also have this under button click
Carlos kambuiPosted May 7, 2015, 5:11 AM
Dipankar BiswasPosted May 7, 2015, 5:09 AM
Your requirements not clear...
see this link ... https://msdn.microsoft.com/en-us/library/ms749011(v=vs.110).aspx
thanks..