you need to specify the column as integer while defining the
datatable. like this:-
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) firstname (varchar\nvarchar) lastname (varchar\nvarchar) showsnumber (int) visitnumber (int) cancellation (int)
as far as i am aware, you need to set the type of the column on the datatable, otherwise it will presume string (because nearly everything can be converted as such).
before you set the values, try:
datatable.columns.type = typeof (int);
or, alternatively, you can specify it when defining the columns:
- The given value of type String from the data source cannot be converted to type int of the specified target column
- get selected value from combobox with data source is anonymous type
- data type(s) of the type parameters ) in method cannot be inferred from these arguments
- How to get a single value from a Dictionary<Key,Value> given a property that belongs to the type Value
- The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly
- LINQ - type arguments cannot be inferred from the usage in a select
- LINQ error: The null value cannot be assigned to a member with type System.Int32 which is a non-nullable value type
- How does linq actually execute the code to retrieve data from the data source?
- When called from 'VisitLambda', rewriting a node of type 'System.Linq.Expressions.ParameterExpression' must return a non-null value of the same type
- LINQ Select - CS0411 The type arguments cannot be inferred from the usage - What am I doing wrong?
- The type arguments for method GroupJoin cannot be inferred from the usage
- Linq - Value of type 'System.Guid' cannot be converted to 'String'
- "Value cannot be null" while creating an XElement from the attributes where one or more value is null
- The null value cannot be assigned to a member with type System.Boolean which is a non-nullable value type
- The text data type cannot be selected as DISTINCT because it is not comparable
- custom icomparer error - The type arguments cannot be inferred from the usage
- The type arguments for method cannot be inferred from the usage. Try specifying the type arguments explicitly
- The null value cannot be assigned to a member with type System.Int32 which is a non-nullable value type
- How to get the string value of ExecuteCommand (or ExecuteQuery) from LINQ?
- How to take value based on previous node from the given xml file
- Issue with OrderBy type cannot be inferred from the usage
- The null value cannot be assigned to a member with type Int32 but strings work
- Cannot be inferred from the usage. Try specifying the type arguments explicitly
- The type arguments cannot be inferred from the usage
- LINQ-to-SQL - The null value cannot be assigned to a member with type
- The type '' cannot be used as type parameter 'T' in the generic type or method ''. There is no implicit reference conversion from '' to ''
- How to check comma separated values stored in data base column having the given value using linq in c#
- Generic lists: The type arguments for method cannot be inferred from the usage in lambdas
- The type arguments cannot be inferred from the query
- LINQ entity data model generated code error - The type 'DBContexts.Category' already contains a definition for 'ID'
More Query from same tag
- Merge XDocuments by XAttribute's value
- Is there a way to set the default namespace to query from an XDocument?
- How to write one to many relationship query in C# linq
- Reusing Base Linq Query from one method to another
- Getting minimum date from a list of records with date columns
- Can one use "in" type statements in C# and LINQ Lambda expressions?
- C# - Joining two LanguageExt Either<Error, List<T>> on matching key
- C# - LINQ query returns null to table and throws exception
- If statement in OrderBy method over Where method
- Linqtoxml filtering not working
- Sort a WPF DataGrid by a value within a group
- c# Linq - Is this a good design for deleting records?
- How to make LINQ-to-Objects handle projections?
- XML to custom Object
- how to join two tables where the condition 'Where' is related to a third table that is associated with the first table
- Remove errors of type Required from ModelState
- Can I use a collection initializer with LINQ to return a fully populated collection?
- Implicitly convert type 'int?' to 'int'
- LINQ Join on multiple fields
- C# LINQ Filter deep nested list
- Sequence contains no elements Error
- How to take top 10 when lazy loading multiple levels in EF7
- Cannot implicitly convert type 'System.DateTime?' to 'int?' C# Linq
- Linq Check if array of string has a partial match in other array
- C# - How to find most frequent date from list
- Group items and select specific item from each group with LINQ
- Remove both duplicate items (if one is duplicate) from a list using Linq
- Projecting to domain class with constructor with EF with AsEnumerable
- LINQ to Entity Any() with related Object Collection
- GroupBy with different parameters