code is
if (objRead.HasRows)
{
while (objRead.Read())
{
int ll = objRead.GetOrdinal("lastLogon");
Label1.Text = objRead.GetString(ll); //.GetValue(ll).ToString(); //.GetString(1);
Label1.Visible = true;
}
}
exception is
Exception System.InvalidCastException: Unable to cast COM object of type 'System.__ComObject' to class type 'System.String'. Instances of types that represent COM components cannot be cast to types that do not represent COM components; however they can be cast to interfaces as long as the underlying COM component supports QueryInterface calls for the IID of the interface. at System.Data.OleDb.ColumnBinding.ValueString() at System.Data.OleDb.OleDbDataReader.GetString(Int32 ordinal) at _Default.Page_Load(Object sender, EventArgs e) .
Exception only occurs at Lastlogin, for other items it works perfectly.
Is there any other way to get lastlogin time?
Md MushtaquePosted Aug 7, 2008, 1:20 AM
I have to in C# code as myself is VB programmer, I will reply you soon let me check.