I need retrieve time from sqlserver to asp.net using c# in a textbox
i need retrieve time from sqlserver to asp.net using c# in a textbox.........
protected void Page_Load(object sender, EventArgs e)
{
SqlDataReader sdr = null;
string qry = "select logintime from logintime";
ds = net.GETDS(qry);
da.Fill(ds, "logintime");
// TextBox1.Text = ds.Tables["logintime"].Rows[indes]["logintime"].ToString();
while (sdr.Read())
{
TextBox1.Text = sdr["logintime"].ToString();
}
}
}
it throws the error like this ( The SelectCommand property has not been initialized before calling 'Fill'.)