Solved

Mysql with Linq 2 Entities

Posted on 2010-09-02
3
395 Views
Last Modified: 2012-05-10
I want to recieve all rows from a mysql table and got problems immedietly when adding a "created" field to the model. The created-field is a TIMESTAMP in mysql and appears to be a DateTimeOffset in the model. This give me bug-like-problem when reading the data. How am I possible to cast this field to a string or something?

0
Comment
Question by:dingir
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 13

Accepted Solution

by:
Ashok earned 500 total points
ID: 33585796
public static string TimestampToString(this System.Data.Linq.Binary binary)  
{
  byte[] binarybytes = binary.ToArray();  
  string result = "";  
  foreach (byte b in binarybytes)  
  {
    result += b.ToString() + "|";  
  }
  result = result.Substring(0, result.Length - 1);
  return result;  
}  

>>>>> There is one more >>>>  public static System.Data.Linq.Binary StringToTimestamp(this string s)

Read complete articel @ http://geekswithblogs.net/AndrewSiemer/archive/2008/02/11/converting-a-system.data.linq.binary-or-timestamp-to-a-string-and-back.aspx

HTH
Ashok
0
 
LVL 1

Author Comment

by:dingir
ID: 33593792
Wow that was a hack..

However i seemed to fix it just by adjust connection string.. i will check it today and leave a  feedback
0
 
LVL 1

Author Closing Comment

by:dingir
ID: 33698785
Not really a solution but maybe it help someone else,
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Najam
Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

695 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question