int i = 0;

// This works and does prints "1".
Response.Write(myCommand.ExecuteScalar());



// This results in the error below.
i = (int)myCommand.ExecuteScalar();


System.InvalidCastException: Cannot cast from source type to destination type.
in <0x000c3> ASP.login_aspx:CheckUserCredentials (System.String username, 
System.String password)
in <0x00065> ASP.login_aspx:btnSubmit_Click (System.Object sender, 
System.EventArgs e)
in (wrapper delegate-invoke) 
System.MulticastDelegate:invoke_void_object_EventArgs (object,System.EventArgs)
in <0x00066> System.Web.UI.WebControls.Button:OnClick (System.EventArgs e)
in <0x00045> System.Web.UI.WebControls.Button:RaisePostBackEvent (System.String 
eventArgument)
in <0x0000d> 
System.Web.UI.WebControls.Button:System.Web.UI.IPostBackEventHandler.RaisePostBackEvent
 (System.String eventArgument)
in <0x00016> System.Web.UI.Page:RaisePostBackEvent (IPostBackEventHandler 
sourceControl, System.String eventArgument)
in <0x00031> System.Web.UI.Page:RaisePostBackEvents ()
in <0x001ee> System.Web.UI.Page:InternalProcessRequest ()
in <0x000a4> System.Web.UI.Page:ProcessRequest (System.Web.HttpContext context)


The value should* be able to cast into an int?  I'm converting some stuff off 
SQL server and the equivalent code works in mono.. The only thing I can think 
is I'm testing this on my dev server which is using a different version of 
Mono/Npgsql.  Anyone have any ideas.. I'll play with boxing/unboxing, assuming 
ExecuteScalar returns an object, to see if it's a Mono or Npqsql issue and if 
it's in SVN head.

Thanks

C.

_______________________________________________
Mono-list maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-list

Reply via email to