Rectangle 27 0

The reason is that the property returns an array but has no parameter. You think that you are using it with an argument but actually you are accessing one index of the array (if BatchClassName is an Integer).

So write it in this way:

BatchIDs = m_oBatMan.GetBatchIDs

But it seems not to be the real/complete code since it does not even compile.

Public ReadOnly Property GetBatchIDs() As Integer()

gives an: "'ReadOnly' property must provide a 'Get'"

But if you add the getter:


returns an Integer not an Integer-array because you are using the indexer ( which is () in VB.NET as opposed to C# where it is [] ). Of course presuming that BatchClassName is an Integer which you still haven't mentioned.

When I right click it and choose go to definition it goes to that method though. Its weird. I think something in the project is screwed up

There's nothing wrong with the project. Notice that GetBatchIDs() is not a method; is a property, of type "Array of Integers". When you use it like Tim said, you are accessing the whole array; when you use like your example, you are accessing only one element of the array.

Can you show the real code since your code does not even compile. Public ReadOnly Property GetBatchIDs() As Integer() gives an: "'ReadOnly' property must provide a 'Get'" But if you add the getter m_oBatMan.GetBatchIDs(BatchClassName) returns an Integer not an integer-array because you are using the indexer (which is (] in VB.NET as opposed to C# where it is [] ). Of course presuming that BatchClassName is an Integer which you haven't mentioned.

... there was a typo in my comment, (] was meant to be (). - value of type integer cannot be converted to 1-dimensional ar...

Rectangle 27 0

I converted query to use LINQ instead of the Lambda methods. It is easier for me to read queries when they are written in LINQ syntax.

How does the db.Location relate to pg.ListSelectedGrpDescID.Count == 0? What should db.Location return if it is 0? I left this part of the query out for now.

It can be a good idea to break the problem up into steps when trying to find a solution. This is a first step towards the solution.

First, we can refactor the ListGrpHolder ID's into another statement. This will return only the int value and make the ListLocation query easier to read.

var SelectedIds = ListGrpHolder.Select(pg => pg.ListSelectedGrpDescID).SelectMany(i => i);
var ListLocation = (from loc in db.Locations
                    from grp in loc.GroupLocations
                    where SelectedIds.Contains(grp.GrpDescID)
                    select loc).ToList();

If we are not able to simplify or change the query to get the results you need, then we can look into using an Expression Tree. mvc 2 - Expression Tree error: Unable to create a constant val... entity-framework-4 linq-to-entities
Rectangle 27 0

You need to specify the column as integer while defining the datatable. Like this:-

dataTable.Columns.Add("customerID", typeof(int));

Edit: The other reason i suspect is probably the way you are binding your datatable (I mean the order of columns) doesn't match with that of database table. Reason being I think default mapping is not Name to Name rather its Index to Index in SqlBulkCopy. So Kindly re-check your database table order, It should look like:-

CustomerID (INT)
ShowsNumber (INT)
VisitNumber (INT)
Cancellation (INT)

I still got the same exact exception

@MarcoDinatsoli - Are you sure all your columns in database are of type INT? I mean the ones you have defined in your Type definition like CustomerID,ShowsNumber etc?

@MarcoDinatsoli - Please check my edit and see if that helps.

c# - The given value of type String from the data source cannot be con...

c# linq linq-to-xml sqlbulkcopy
Rectangle 27 0

Your error is an error the SQL Server produces when a string cannot be converted to an integer, in a context where the database thinks this is necessary.

You have these expressions in the where clause:

'" + start_cd + "'!=0 or '" + end_cd + "'!=0

You are explicitly comparing a string (in single quotes) to an integer (0). This is one of those situations. This will generate the error if the string is not in a numeric format.

I don't know what you want to do, perhaps one of the following:

'" + start_cd + "'!='0' or '" + end_cd + "'!='0'
'" + start_cd + "' is not null or '" + end_cd + "' is not null

Refer to column names and not a string:

" + start_cd + "!=0 or " + end_cd + "!=0

i used this solution " + start_cd + "!=0 or " + end_cd + "!=0 but listbox show System.Data.DataRowView (my sql table column Data type int)

c# - Conversion failed when converting the varchar value 'FOT' to data...

c# sql .net sql-server
Rectangle 27 0

This error is caused because you are trying to pass as a parameter or function return value a single integer when it expects an array. You didn't include enough in your code to be more specific. (Which line is the error on? What is employeeIDFilter? What is DoSomething?)

kindly have a look at the edited post, i have added brief explanation - value of type integer cannot be converted to 1-dimensional a...
Rectangle 27 0

noPic is a query. It's not an integer - it's a sequence of integers. So you can't convert it to a single integer, and it sounds like you don't want it to.

Dim show = From s In myEntities.UserProfiles
           Where noPic.Contains(s.UserID)
           Select s.UserID, s.FirstName, s.LastName, s.ImUrl

Alternatively, write the whole thing as a join to start with. (I'm not au fait with VB LINQ syntax, otherwise I'd do that for you.) - Value of type 'System.Linq.IQueryable(Of Integer)' cannot be ... linq entity-framework
Rectangle 27 0

The variable reading is a OleDbDataReader which can't be used to assign an integer, that's the reason for the error. But you don't need a DataReader anyway if you use ExecuteScalar:

Dim maxNumber As Int32 = Convert.ToInt32(cmd.ExecuteScalar())
TextBox1.Text = maxNumber.ToString

Suggesting a check for DBNull on MAX

Yes, maybe, hope that he never adds a where to the sql.

Value of type 'Integer' cannot be converted to 'System.Data.OleDb.OleD... type-conversion
Rectangle 27 0

@Inherits System.Web.Mvc.ViewPage(Of MyApp.Core.Domain.User)
@ModelType MyApp.Core.Domain.User

The base type for Razor pages is System.Web.Mvc.WebViewPage. Or as you've discovered you can just use the @ModelType keyword. mvc 3 - MVC Error (Razor) Value of type 'System.Web.Mvc.MvcHtm... razor
Rectangle 27 0

Had this problem after upgrading to VS 2012 with a <table run="server"...> that contained a <tbody> element. Removing the <tbody> resolved the build error for me. - VS 2010: Value of type 'System.Web.UI.HtmlControls.HtmlGener... visual-studio-2010 visual-studio-2012
Rectangle 27 0

php - org.json.JSONException: Value