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

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

Conversion: EF 3.5 to 4.0

Posted By:      Posted Date: August 29, 2010    Points: 0   Category :ASP.Net
I have converted the BeerHouse sample (here) from .NET 3.5 (Visual Studio 2008) to .NET 4.0 (Visual Studio 2010 RC). After working through quite a few compilation errors (mostly C# namespace issues and differing referenced assemblies), and after figuring out how to deal with the sample database, when I tried to run the site (MVC), EF throws this exception when loading the database-stored site map: "Schema specified is not valid. Errors: error 0194: All artifacts loaded into an ItemCollection must have the same version. Multiple versions were encountered.error 0194: All artifacts loaded into an ItemCollection must have the same version. Multiple versions were encountered.error 0194: All artifacts loaded into an ItemCollection must have the same version. Multiple versions were encountered.error 0194: All artifacts loaded into an ItemCollection must have the same version. Multiple versions were encountered.error 0194: All artifacts loaded into an ItemCollection must have the same version. Multiple versions were encountered.error 0194: All artifacts loaded into an ItemCollection must have the same version. Multiple versions were encountered." I did updated the model from the database in the designer, and that updated the XML namespaces in the .edmx file. That also tells me that I have a connection to the database (it didn't error) and that the database schema should m

View Complete Post

More Related Resource Links

Program for Format Conversion of An Image

.NET provides extensive support for image conversion. Any image can be processed from one format to another. Most common formats to which .NET have support for are .BMP, .EMF, .GIF, .ICO, .JPG, .PNG, .TIF and .WMF.

Conversion of text files from ANSI to UTF-8

reading and writing text files in ANSI format and
writing html-files in Charset ISO-8859-1 (Western Europe).

WebMatrix conversion failed when converting from a character string to uniqueidentifier?


I am trying to retrieve xml from a small function in my .cshtml page. Its throwing me an error. This however, runs fine in a console/form environment.

It takes 3 parameters and 1 exception.

myDll.GetXML(year, username, uniqueidentifier, out ex);

When I run this page I get the error, "Conversion failed when converting from a character string to uniqueidentifier."

Or a stack of.

System.Data.SqlClient.SqlException (0x80131904): Conversion failed when converting from a character string to uniqueidentifier.

   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)

   at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)

   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning()

   at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)

   at System.Data.SqlClient.SqlDataReader.ConsumeMetaData()

   at System.Data.SqlClient.SqlDataReader.get_MetaData()

   at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)

   at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBeha

C# conversion to VB and properties


I am trying to implement image caching for a web application and I found some code on the Internet that implements an HttpHandler that does this. The code was in C# and since my web app is written in VB, I decided to convert the code to VB. I managed to convert everything except the following code (in bold):

public class FileExtensionCollection : ConfigurationElementCollection
        public override ConfigurationElementCollectionType CollectionType
                return ConfigurationElementCollectionType.AddRemoveClearMap;

        public FileExtension this[int index]
            get { return (FileExtension)BaseGet(index); }

Conversion of List to DataTable and ViceVersa


hi ,

           Iam having a requirement where I wil get datatable or Dataview from the DataAccessLayer I need to convert them into GanaricList of entites and ViceVersa from GenericList to Datatable or DataView.

             I tried it but I cant. Can anybody help me out.

Toolbox: Live Chat, Code Conversion, Multiple Monitors, and More


This month, more of the tools you need to get your job done.

Scott Mitchell

MSDN Magazine December 2007

Conversion from string to type 'Date' is not valid



Im receiving a strange error Error Message: Conversion from string "15/08/2010 22:21:35" to type 'Date' is not valid.

I know this is generally down to cultural date formats etc, however the reason this is strange is it just randomly occured twice in the last week, the website has been running since october and nothing has changed,

The error constantly occured until the IIS was reset and recompilled the site, its been running fine since, however im just trying to figure out what could cause such an error to occur.

I've narrowed it down to a line of code which is:

bktime = DReader.Item("Bktime").ToString

bktime = Year(CDate(bktime)) & "-" & fmt(Month(CDate(bktime)), 2) & "-" & fmt(Day(CDate(bktime)), 2)

Has anyone else encountered this randomly occuring and is there anything i can put in place to prevent this in future?



ASP.NET DateTime Conversion strange behaviour



I am working on ASP.NET web application where we are using javascript calendar to accept the date in textboxes. The date format is dd/mm/yyyy. The application is running in US and UK environments.

I am facing issues in US environment while storing the dates so I have added 2 keys in config file viz culture which will be either en-US or en-GB depending on the deployment location and baseCulture which will always be en-GB.

In the code, I have added a condition which checks if culture and baseCulture values are not matching then do the conversion of date in US format.

But I have found that the code converts the date from dd/mm/yyyy to mm/dd/yyyy when the key is baseCulture (en-GB) and it throws FormatException when key is culture (en-US).

I am bit confused by this behaviour. Is this normal? Can any one please explain more about this? Note: I am working on a machine which has en-US as language and culture

<add key="culture" value="en-US" />
<add key="baseCulture" value="en-GB" />
// This line works and converts the date from 26/08/2010 to 08/26/2010
// Here the baseCulture is en-GB.
DateTime dt = DateTime.Parse(txtCurrentDate,baseCulture)

// This line throws FormatException. culture 

Document Conversion of large files



My MOSS 2007 environment fires OutOfMemory exceptions when attempt to launch a custom Document Converter on files larger then 50 MB (Video files) . Because my Document Converter is implemented by a standalone executable, I'm figuring these exceptions are fired by Sharepoint Work process, on downloading/uploading from/to temp folder, not by my custom converter.

If this is the case, can I apply any workarounds on server configuration ? I tried with /3GB switch without luck. Maybe SP1 will address this issue too ?



Conversion of Byte Array to Memory stream


how to convert byte array to memory stream in vb.net.

arithmatic conversion in Getter/Setter



 In my application I need to allow for someone to enter in a floating point value.
However that value will be rounded up to an integer.

The challenge here is that I am using a getter and setter. If I try and use mixed data types in the getter setter,
it does not work for me. Can someone help me out?

Dim _length As Integer

Public Property Length() As Integer
                        Return _length
                End Get
                Set(ByVal value As fixed)
                        _length = System.Math.Ceiling(value) ' Accept a float/double as input and return an integer
                End Set
        End Property

Data Conversion - string to datetime help!!!

Hi all, I need help on concatenate two fields into one then display it as datetime format as such yyyy-mm-dd hh:mm:ss AM/PM. The db is on SQL 2008 SP1. The date and time columns are on the same table and store as varchar. Date has varchar(10) and time has varchar(16). Date column shows result from query is 20100827 while the time column is either 070101.000000 or 070101. The question is how go about concatenate the two together and display in the format above in a report? How should I write my select query for this report? I am using SQL 2008 R2 BI Development Studio to design my report. Thank you. VCHS

Need help in datetime conversion excluding invalid records

I have varachar(50) field which have date in yyyymmdd format Now i have to filter the data which are greater then server date I have following query Select * from MDB_CONTENT_INFO Where convert(datetime, CON_SCHEDULED_INDUCTION_DATE,112) >= GetDate() Problem ist aht i may have some invalid data other then valid one. I am getting error The conversion of a varchar data type to a datetime data type resulted in an out-of-range value. or Conversion failed when converting date and/or time from character string. I wanted to exclude those records but currently getting error for the query asKamran Shahid Senior Software Engineer/Analyst (MCP,MCAD,MCSD.NET,MCTS,MCPD.net[web])

Conversion Failed when Converting the nvarchar value 'N' to data type int.

Hi.. I am facing a strange situation. when i executing the following query it is returning the error SELECT  s.row_id as shipment,    SUM(CAST(la5.attr_value AS INT)) AS Cases     FROM    shipment s WITH(NOLOCK)    INNER JOIN shipping_shift ss WITH(NOLOCK) ON s.shipping_shift = ss.row_id    INNER JOIN shift WITH(NOLOCK) ON ss.shift_id = shift.shift_id    INNER JOIN shipment_lot sl WITH(NOLOCK) ON s.po_id = sl.po_id AND s.cust_id = sl.cust_id AND          s.so_line_no = sl.so_line_no and s.ship_date_local = sl.ship_date_local     INNER JOIN lot_attr la5 WITH(NOLOCK) ON sl.lot_no = la5.lot_no AND sl.item_id = la5.item_id AND la5.attr_id = (SELECT attr_id FROM attr WITH(NOLOCK) WHERE attr_desc = 'CaseQty' AND attr_grp = 3)  WHERE s.spare2 = 'RELEASED'       AND shift.shift_desc = 'c'   AND DAY(ss.production_date) = DAY('2010-08-09 00:00:00.000')    AND MONTH(ss.production_date) = MONTH('2010-08-09 00:00:00.000')    AND YEAR(ss.production_date) = YEAR('2010-08-09 00:00:00.000') GROUP BY s.row_id  Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the nvarchar value 'N' to data type int. The column  type of attr_value of lot_attr table is a USER D

Sql DateTime2 to .NET DateTime conversion results in out-of-range exception

I posted it in C# General because I thought that the subject was not Sql Smo related, although I use Smo extensively even in this routine for connection. Unfortunately after a few days no constructive suggestion has been advanced. Two posts the thread collected are not helpful. I am wondering if Alok or someone else with the status of MSFT Sql Server developers take a look at this very importan problem for me which became a stumbling block.Thanks. AlexB - Win_7 Pro64, SqlSer64 WinSer64

Conversion of db table into xml

i have a database in SQL 2005. i need to convert two of them in xml with complete architecture/format and data. e.g: Table A (  ID  int pk, age int , name varchar(50), group varchar(50))   Table B (     Roll_No int FK(ID,age)       )   etc. Data: Select * from  A;   ID age name group 1 22 ahmed Pre_medical 2 23 tania Pre_eng  3 25 ahsan A-level Select * from B; Roll_No 122 223 325   Please suggest.maifs
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