?
Solved

Mysql with Linq 2 Entities

Posted on 2010-09-02
3
Medium Priority
?
398 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 1500 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: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying 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

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

752 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