.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
ASPEvil
david stephan
Santhakumar Munuswamy
Fauzul Azmi
Post New Web Links

Unable to convert type System.String to System.Web.DynamicData.MetaTable

Posted By:      Posted Date: October 18, 2010    Points: 0   Category :ASP.Net
 

Hi,

I am encountering the problem  "Unable to convert type System.String to System.Web.DynamicData.MetaTable" when I hit one of the tables for List.aspx.  It is using the DynamicData/PageTemplates/List.aspx and this error is not happening in other tables.

It is happening on the line

GridView1.SetMetaTable(table, table.GetColumnValuesFromRoute(Context));

If you have any leads, please let me know.

Thanks.

CC




View Complete Post


More Related Resource Links

Unable to cast object of type 'System.Guid' to type 'System.String'.

  
protected void Button1_Click(object sender, EventArgs e) { using (BurnbetDataContext dc = new BurnbetDataContext()) { var q = (from c in dc.GetTable<tbl_Payment>() where c.ID == 5 select c).Single<tbl_Payment>(); dc.GetTable<tbl_Payment>().DeleteOnSubmit(q); dc.SubmitChanges(); } } }System.InvalidCastException was unhandled by user code  Message=Unable to cast object of type 'System.Guid' to type 'System.String'.  Source=System.Data.Linq  StackTrace:       at System.Data.Linq.SqlClient.SqlProvider.Execute(Expression query, QueryInfo queryInfo, IObjectReaderFactory factory, Object[] parentArgs, Object[] userArgs, ICompiledSubQuery[] subQueries, Object lastResult)       at System.Data.Linq.SqlClient.SqlProvider.ExecuteAll(Expression query, QueryInfo[] queryInfos, IObjectReaderFactory factory, Object[] userArguments, ICompiledSubQuery[] subQueries)       at System.Data.Linq.SqlClient.SqlProvider.System.Data.Linq.Provider.IProvider.Execute(Expression query)       at System.Data.Linq.DataQuery`1.System.Linq.IQueryProvider.Execute[S](Expression expression)&nb

Unable to cast object of type 'System.DBNull' to type 'System.String'.

  

 I saw lots of post about this issue. but haven't got good solution for that yet. Basically, what I did is that: I have a table in SQL database and some of data fields allow null. I built Objectdatasource through dataset. When I built update page using dataset. It generate the following error before showing the update page correctly. It seems I have issue to retrieve the null value from the database through using objectdatasource through dataset. Any suggestions?

 

Xinguo

 

Error attached below:

Unable to cast object of type 'System.DBNull' to type 'System.String'.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidCastException: Unable to cast object of type 'System.DBNull' to type 'System.String'.

Source Error:

Line 1178:            get {
Line 1179:                try {
Line 1180:                    return ((string)(this[this.tablemember.CurrentCityStateColumn]));
Line 1181:                

Unable to cast object of type 'System.Web.Mvc.ValueProviderResult' to type 'System.IConvertible'

  

Hello,
 Why am I getting this error on line:

               sp.Price = Convert.ToDecimal(collection.GetValue("Price"));

sp is :
  SPecials_Templates sp = new SPecials_Templates();

SPecials_Templates Defined:

    [MetadataType(typeof(SPecials_TemplatesMetaData))]
    public partial class SPecials_Templates
    {
        public class SPecials_TemplatesMetaData
        {

                [ScaffoldColumn(false)]
            public object Key { get; set; }
            [StringLength(50)]
            public object Template_Name { get; set; }
            [StringLength(12)]
            public object Headline { get; set; }
            [StringLength(12)]
    &nbs

How to convert System.Type to Data.DbType?

  
Hi,Is it possible to convert a System.Type to Data.DbType (this is unfortunately an enumaeration)?Thanks, Rainer.

Unable to cast COM object of type 'System.__ComObject' to interface type 'IRowset'

  
I'm repairing a custom cube being fed off a Dynamics AX 2009 instance. This particular named query looks like this: SELECT CUSTTABLE.ACCOUNTNUM, CUSTTABLE.CASHDISC, CUSTTABLE.SHIPCARRIERBLINDSHIPMENT, CUSTTABLE.PARTYTYPE, CUSTTABLE.PARTYID, CUSTTABLE.SHIPCARRIERACCOUNTCODE, CUSTTABLE.PROJPRICEGROUP, CUSTTABLE.SYNCENTITYID, CUSTTABLE.SYNCVERSION, CUSTTABLE.MEMO, CUSTTABLE.SALESDISTRICTID, CUSTTABLE.CURRENCY, CUSTTABLE.SEGMENTID, CUSTTABLE.SUBSEGMENTID, CUSTTABLE.COMPANYCHAINID, CUSTTABLE.MAINCONTACTID, CUSTTABLE.IDENTIFICATIONNUMBER, CUSTTABLE.PARTYCOUNTRY, CUSTTABLE.PARTYSTATE, CUSTTABLE.SALESGROUP, CUSTTABLE.BLOCKED, CUSTTABLE.ONETIMECUSTOMER, CUSTTABLE.ACCOUNTSTATEMENT, CUSTTABLE.CREDITMAX, CUSTTABLE.MANDATORYCREDITLIMIT, CUSTTABLE.DIMENSION, CUSTTABLE.DIMENSION2_, CUSTTABLE.DIMENSION3_, CUSTTABLE.NAME, CUSTTABLE.VENDACCOUNT, CUSTTABLE.TELEX, CUSTTABLE.PRICEGROUP, CUSTTABLE.MULTILINEDISC, CUSTTABLE.ENDDISC, CUSTTABLE.VATNUM, CUSTTABLE.COUNTRYREGIONID, CUSTTABLE.INVENTLOCATION, CUSTTABLE.DLVTERM, CUSTTABLE.DLVMODE, CUSTTABLE.ADDRESS, CUSTTABLE.MARKUPGROUP, CUSTTABLE.MBSFIRSTNAME, CUSTTABLE.MBSLASTNAME, CUSTTABLE.MBSMESSAGETEXT, CUSTTABLE.MBSNOBOALLOWED, CUSTTABLE.MBSCOLLECTORCODE, CUSTTABLE.MBSDLVROUTESEQ, CUSTTABLE.MBSBOALLOCATIONPRIORITY, CUSTTABLE.MBSCUSTEMOTION, CUSTTABLE.MBSPRICEFLOOR, CUSTTABLE.MBSPRICECEILING, CU

cannot be applied to operands of type 'string' and 'System.Guid'

  
MembershipUser myObject = Membership.GetUser(); string UserID = myObject.ProviderUserKey.ToString(); BurnbetDataContext db = new BurnbetDataContext(); var creditcard = from c in db.tbl_Payments where UserID == c.UserId select c; Column UserId = uniqueidentifier Compilation Error Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. Compiler Error Message: CS0019: Operator '==' cannot be applied to operands of type 'string' and 'System.Guid'Source Error: Line 93: Line 94: var creditcard = from c in db.tbl_Payments Line 95: where UserID == c.UserId Line 96: select c; Line 97: Please help!

Object of type 'System.Int32' cannot be converted to type 'System.String

  

When i'm trying to update a table using dynamic data, i'm getting the following error. I was trying to google the solution for the whole day, but it didnt work. I tried to declare the type of parameters like this

<asp:LinqDataSource ID="DetailsDataSource" runat="server" EnableUpdate="true"
                OnInserting="DetailsDataSource_Inserting"
                onselected="DetailsDataSource_Selected"
                onupdating="DetailsDataSource_Updating" > <UpdateParameters><asp:Parameter Name="PK_ID" Type="Int32" /><asp:Parameter Name="id" Type="Int32" />
                <asp:Parameter Name="c_titulu" Type="Int32" />
                <asp:Parameter Name="perio" Type="Int32" />
            

Unable to cast object of type 'System.Data.SqlClient.SqlCommand' to type 'System.IConvertible'.

  

using

System;

using

System.Collections;

using

System.Configuration;

using

System.Data;

using

System.Linq;

using

System.Web;

using

System.Web.Security;

using

System.Web.UI;

Unable to cast COM oject of type 'System.__ComObject' to class type of 'System.Drawing.Bitmap' .

  
 private void DirectXViewer_DragDrop(object sender, DragEventArgs e)

  {

   mousePressedFlag = false;

   if(e.Data.GetDataPresent(typeof(Bitmap)))

   {

    Object obj = e.Data.GetData(typeof(Bitmap));

    

    {

     try

     {

      Bitmap image = (Bitmap)((Bitmap)obj).Clone();

      RenderImage = image;

      image.Dispose();

     }

     catch(Exception ex)

     {

      MessageBox.Show(ex.Message.ToString());

     }

    

    }

   }

  }

private void DirectXViewer_MouseMove(object sender, MouseEventArgs e)

  {



   if (mousePressedFlag)

   {

    if(cacheBitmap != null)

     this.DoDragDrop(new Bitmap(cacheBitmap), DragDropEffects.Copy);

    

   }

  }

Hi All,

I try to d

Using IPC only channel getting Unable to cast object of type 'System.Runtime.Remoting.Identity' to

  

I have a remoting application that is using delegates to preform callbacks between processes. I found that if I don't use a TCP channel at all and only initialize an IPC channel that the callback delegates start throwing the following error after about a minute has passed.

From what little I could find on Google it seems to be a Lifetime Service management issue but all the classes that the delegates belong to return null from InitializeLifetimeService which should give the object an infinite lifetime.

With the TCP channel initialized the issue doesn't happen, but I would like it to use the IPC channel if all of the processes are on the local box.

 

Type:        System.InvalidCastException
Message:    Unable to cast object of type 'System.Runtime.Remoting.Identity' to type 'System.Runtime.Remoting.ServerIdentity'.
Stack Trace:   
Server stack trace:
   at System.Runtime.Remoting.RemotingServices.GetServerTypeForUri(String URI)
   at System.Runtime.Remoting.Channels.BinaryServerFormatterSink.ProcessMessage(IServerChannelSinkStack sinkStack, IMessage requestMsg, ITransportHeaders requestHeaders, Stream requestStream, IMessage& responseMsg, ITransportHeaders& responseHeaders, Stream& responseStream)

Exception

Unable to convert MySQL date/time value to System.DateTime

  

Hi

I get the following error when i call my method from the class any ideas?
 

Unable to convert MySQL date/time value to System.DateTime

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: MySql.Data.Types.MySqlConversionException: Unable to convert MySQL date/time value to System.DateTime

Source Error:

Line 324:        string strqry = "Select * FROM tblclients";
Line 325:
Line 326: DataTable returnDatatbl = conClass.queryDB(strqry);
Line 327:
Line 328:

Cannot implicitly convert type 'System.Web.UI.WebControls.TreeNode' to 'System.Xml.XmlNode

  

Hi,

I bind xml to treeview and select the node.I write code as

XmlNode xnParent = TreeView1.SelectedNode.Parent;
        XmlNode xnchild = TreeView1.SelectedNode;


But i got error these places.


Error    1    Cannot implicitly convert type 'System.Web.UI.WebControls.TreeNode' to 'System.Xml.XmlNode'    E:\SVN_WORK1\Projects\Server\VegaFABSWeb\Admin\DataDictionary.aspx.cs    36    28    E:\...\VegaFABSWeb\


Thanks,

Rama Krishna




Unable to cast COM object of type 'System.__ComObject' to interface type 'IRowset' in BIDS

  
Hello.
I'm using BIDS for working with SSAS. I have bug with New Named Query feature.
Steps to reproduce:
1. Set up any data source.
2. Set up new data source view with any tables.
3. Right click on DSV body. Select 'New Named Query'
4. Switch to Generic Query Builder.
5. Type any query. For instance 'select name from sys.sysobjects'
6. Press Run button

After this message:
TITLE: Microsoft Visual Studio
------------------------------

An error occurred while reading data from the query result set.
Unable to cast COM object of type 'System.__ComObject' to interface type 'IRowset'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{0C733A7C-2A1C-11CE-ADE5-00AA0044773D}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).

------------------------------
ADDITIONAL INFORMATION:

Unable to cast COM object of type 'System.__ComObject' to interface type 'IRowset'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{0C733A7C-2A1C-11CE-ADE5-00AA0044773D}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)). (System.Data)

---------

SPGridView Control: Paging Error - "Unable to cast object of type 'System.Int64' to type 'System.

  

Hello,

I'm creating project in VS 2010 using VisualWebPart. I'm using SPGridView for my grid in the web part. To acheive this, I've done following:

I added following xml in my ascx control

<SharePoint:SPGridView runat="server" ID="grdView" AutoGenerateColumns="false" AllowPaging="true" PageSize="2&

"Unable to cast object of type 'System.Windows.Controls.Expander' to type 'System.Windows.Control

  

Hello,

I Got This Error: "Unable to cast object of type 'System.Windows.Controls.Expander' to type 'System.Windows.Controls.GroupBox'"

 

In XAML file Code of Control Herarchy is like this

<GroupBox>

<DockPanel>

<ScrollViewer>

<DockPanel>

here i declare 10 Expander

<Expander 1>...<expander10>

and in each expander there is 1 <Grid> Control

</DockPanel> 

</ScrollViewer>

</DockPanel> 

</GroupBox>

Now my code is working fine....but problem is i want to remove Expander10

so i removed <Expander10> andrelated code from CS file.

codes compiled successfully. but when i Open this screen i got this error on InitializeComponent() and Error shows in XAML page.

is

"Unable to cast object of type 'System.Windows.Controls.Expander' to type 'System.Windows.Controls.GroupBox'"

Please Help me for this Error.

it's really strenge what's wrong in removing expander from herarchy......



Unable to cast object of type 'System.Data.DataSet' to type 'DataSet'.

  
Specifications : VS 2008 & SQL 2005 Express
Unable to cast object of type 'System.Data.DataSet' to type 'DataSet'.
I'm getting this error in cliend app, while passing values to the wcf service(iis),
WCF Sevice code
  public DataSet ListofAccounts(string custidno)
  {
    SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["ConStrWestSideBank"].ConnectionString);
    SqlDataAdapter da = new SqlDataAdapter("select * from AccountDetails where vCustIdentityNo ='" + custidno + "'", con);
    DataSet ds = new DataSet();
    da.Fill(ds, "AccountDetails");
    return ds;
  }
I'm unable to get this, i tried in many ways but no use, please help me. Follwing is the code,of button click event 
   ServiceReference1.ServiceClient svcobj = new

System.Security.SecurityException: Request for the permission of type 'System.Web.AspNetHostingPerm

  

Good Day all,

Having an issue with an outside user accessing my IIS7 box. I do not have this problem when running the website from my host machine. I found this post: Http://forums.asp.net/t/1371394.aspx. I assure you that this is not a solution because I am not storing any of my files on a network share. 

What do you think my approach should be. 


I already have read rights to IIS user to my BIN folder. 


Thanks for the help. 


Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend