locked
Entity Framework exception RRS feed

  • Question

  • Hello,

    When i try to insert 3 records into one of the table, i am getting the following exception

    "The specified type '' is not a valid provider type."

    Most of the people have encountered this exception but with the type specified between single quotes where i have empty single quotes.I don't know how to resolve this issue.If you have any suggestions, kindly let me know.

    From EF, i am using InsertAllOnSubmit method to do bulk insert of 3 records.

    Here is the stack trace...

       at System.Data.Linq.SqlClient.SqlTypeSystem.ProviderBase.Parse(String stype)
       at System.Data.Linq.SqlClient.SqlFactory.Default(MetaDataMember member)
       at System.Data.Linq.SqlClient.Translator.BuildProjectionInternal(SqlExpression item, MetaType rowType, IEnumerable`1 members, Boolean allowDeferred, SqlLink link, Expression source)
       at System.Data.Linq.SqlClient.Translator.BuildProjection(SqlExpression item, MetaType rowType, Boolean allowDeferred, SqlLink link, Expression source)
       at System.Data.Linq.SqlClient.Translator.BuildDefaultQuery(MetaType rowType, Boolean allowDeferred, SqlLink link, Expression source)
       at System.Data.Linq.SqlClient.QueryConverter.TranslateConstantTable(ITable table, SqlLink link)
       at System.Data.Linq.SqlClient.QueryConverter.CoerceToSequence(SqlNode node)
       at System.Data.Linq.SqlClient.QueryConverter.ConvertOuter(Expression node)
       at System.Data.Linq.SqlClient.SqlProvider.BuildQuery(Expression query, SqlNodeAnnotations annotations)
       at System.Data.Linq.SqlClient.SqlProvider.System.Data.Linq.Provider.IProvider.Execute(Expression query)
       at System.Data.Linq.Table`1.GetEnumerator()
       at System.Data.Linq.Table`1.System.Collections.Generic.IEnumerable<TEntity>.GetEnumerator()
       at System.Linq.SystemCore_EnumerableDebugView`1.get_Items()

    Thanks,

    BR,

    JollyWagoner


    Monday, December 10, 2012 6:47 PM

Answers

  • huh...it turned out that setting the varchar(max) was the culprit where EF wasn't able to convert max keyword to appropriate data length.

    Strange, MS things aren't compatible with MS stuff.

    Cheers !

    BR,

    JollyWagoner

    • Marked as answer by JollyWagoner Monday, December 10, 2012 10:40 PM
    Monday, December 10, 2012 10:18 PM

All replies

  • Can you give us table columns name with types and corresponding Entity property name with its types?

    There must have been some mismatch .


    One good question is equivalent to ten best answers.

    Monday, December 10, 2012 6:56 PM

  • If you have any questions , let me know.
    I am also assuming , there is a mismatch between types but i can't exactly figure out where...is there anyway this can be figured out as you can't step into the code which parses between sqlTypes and EF types which is where the exception is being thrown.

    Thanks,

    BR


    Monday, December 10, 2012 7:12 PM
  • Hi JollyWagoner;

    Can you please post the code that shows what you are attempting to do.

      


    Fernando (MCSD)

    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".

    Monday, December 10, 2012 7:54 PM
  • Ok, i have figured out , it is not at the time of insert but in general if i look at the list loaded from Tables when i tried looking at the Table EF object , the problem is present there too.So it is not tied to INSERT operation.But still i need to find out where exactly is the mismatch.
    Monday, December 10, 2012 8:07 PM
  •   

    When this happens again go to the Error Window right click on the exception and select copy to Clipboard then past here in the forum post.

      


    Fernando (MCSD)

    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".

    Monday, December 10, 2012 8:31 PM
  • I have already pasted the stack trace in the main post.Apart from the stack trace , i just have a message with no type specified in single quotes which is strange in that everybody else who has encountered the same problem has at least type specified between single quotes.
    Monday, December 10, 2012 9:57 PM
  •  

    An exception also includes a message and a inner exception message which is also included with what I requested but is not posted with what your post.


    Fernando (MCSD)

    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".

    Monday, December 10, 2012 10:16 PM
  • huh...it turned out that setting the varchar(max) was the culprit where EF wasn't able to convert max keyword to appropriate data length.

    Strange, MS things aren't compatible with MS stuff.

    Cheers !

    BR,

    JollyWagoner

    • Marked as answer by JollyWagoner Monday, December 10, 2012 10:40 PM
    Monday, December 10, 2012 10:18 PM
  • Just for knowledge , the inner exception was null and the message was there in the original post.

    BR,

    JollyWagoner

    Friday, December 14, 2012 4:15 PM