473,414 Members | 2,019 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

Explicit Data Typing

KodeKrazy
When I try to use LINQ to SQL, I get the following error:

"Data type(s) of the type parameter(s) in method 'Public Sub InsertAllOnSubmit(Of TSubEntity As TEntity)(entities As System.Collections.Generic.IEnumerable(Of TSubEntity))' cannot be inferred from these arguments. Specifying the data type(s) explicitly might correct this error."

Where do I need to specify the data types explicitly? In my
Expand|Select|Wrap|Line Numbers
  1. DB.Items.InsertAllOnSubmit(newCatItem)
statement, or where I declare the variables? (Already typed everything to match my SQL DB in the variable declarations, so if that's correct, I did something wrong)

KK
May 9 '08 #1
4 1871
daniel aristidou
491 256MB
Ok i think the isue is the newcatitem
Can u post the code that sets this variable?
May 9 '08 #2
Expand|Select|Wrap|Line Numbers
  1. Option Infer On
  2. Option Strict On
  3.  
  4. Imports System.Collections.Generic
  5. Imports System.Data
  6. Imports System.Data.Linq
  7. Imports System.Data.Linq.Mapping
  8. Imports System.Data.Linq.SqlClient
  9. Imports System.IO
  10. Imports System.Linq
  11. Imports System.Linq.Expressions
  12. Imports System.Reflection
  13.  
  14. Public Class clsLINQ_Procs
  15.   Private DB As CatDataClassesDataContext
  16.   Public pag As String    ' Page
  17.  
  18.   Public Function AddCat() As Boolean
  19.  
  20.      pag = CType(frmMain.dgvItems.Rows(i).Cells.Item(38).Value.ToString, String)
  21.  
  22.      Dim newCatItem = New Item With {.Page = CType(pag, String)}
  23.  
  24.      DB.Items.InsertAllOnSubmit(newCatItem)
  25.      DB.SubmitChanges() 
  26.  
  27.      Return AddCat=True
  28.  
  29.   End Function
  30. End Class
  31.  
  32.  
There are quite a few other variables but in the interest of simplicity all the other variables are typed and declared in the same manner.

TIA,

KK
May 9 '08 #3
Expand|Select|Wrap|Line Numbers
  1. Option Infer On
  2. Option Strict On
  3.  
  4. Imports System.Collections.Generic
  5. Imports System.Data
  6. Imports System.Data.Linq
  7. Imports System.Data.Linq.Mapping
  8. Imports System.Data.Linq.SqlClient
  9. Imports System.IO
  10. Imports System.Linq
  11. Imports System.Linq.Expressions
  12. Imports System.Reflection
  13.  
  14. Public Class clsLINQ_Procs
  15.   Private DB As CatDataClassesDataContext
  16.   Public pag As String    ' Page
  17.  
  18.   Public Function AddCat() As Boolean
  19.  
  20.      pag = CType(frmMain.dgvItems.Rows(i).Cells.Item(38).Value.ToString, String)
  21.  
  22.      Dim newCatItem = New Item With {.Page = CType(pag, String)}
  23.  
  24.      DB.Items.InsertAllOnSubmit(newCatItem)
  25.      DB.SubmitChanges() 
  26.  
  27.      Return AddCat=True
  28.  
  29.   End Function
  30. End Class
  31.  
  32.  
There are quite a few other variables but in the interest of simplicity all the other variables are typed and declared in the same manner.

TIA,

KK
Not sure why it is putting all the space in the word "Value" but it's not there in my code. Just an FYI... kk
May 9 '08 #4
Still getting the error, still don't know why...
May 13 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Dave Theese | last post by:
Hello again, In the program below, the following line is of interest: bar.insert(make_pair(42, 17)); insert() expects a pair<foo<1>, foo<2> >. I'm giving it a pair <int, int>. But this is...
5
by: Peter Seaman | last post by:
I do recognise a number of very appealing features of C#, in particular the strong typing and the need in some contexts to be very explicit regarding your intention. But the most common operator -...
12
by: Doug Hill | last post by:
Please, Microsoft, update Option Explicit Option Strict barks at late binding. We love late binding. So Option Strict flags too many things. Option Explicit is misleading. It allows Dim...
24
by: Peter Maas | last post by:
The Python FAQ 1.4.5 gives 3 reasons for explicit self (condensed version): 1. Instance variables can be easily distinguished from local variables. 2. A method from a particular class can be...
26
by: samjnaa | last post by:
Hello. Please tell me whether this feature request is sane (and not done before) for python so it can be posted to the python-dev mailing list. I should say first that I am not a professional...
7
by: Protoman | last post by:
Is this an efficient way to integrate an explicit function of x from a to b: #include <iostream> using namespace std; class Integrate { public: Integrate(long double (*f)(long double&...
2
by: Barry | last post by:
The following code compiles with VC8 but fails to compiles with Comeau online, I locate the standard here: An explicit specialization of any of the following:
4
by: sanjaya.swain | last post by:
Hi, I have a doubt regarding explicit and implicit declaration in c++. what is the advantage of explicit over implicit in c++. is it always better to use explicit ? Regards
0
by: greek_bill | last post by:
Hi, I have a template function for which I use SFINAE to restrict one of the parameters. Then I also have a partial specialization of this function.I would like to provide an explicit...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.