Click here to Skip to main content
15,891,863 members
Home / Discussions / C#
   

C#

 
AnswerRe: abstract class Pin
PIEBALDconsult11-Jun-14 9:43
mvePIEBALDconsult11-Jun-14 9:43 
QuestionShowing timezone along with time Pin
nitin_ion11-Jun-14 7:59
nitin_ion11-Jun-14 7:59 
AnswerRe: Showing timezone along with time Pin
Pete O'Hanlon11-Jun-14 9:09
mvePete O'Hanlon11-Jun-14 9:09 
QuestionOutput to Promotion LCD from a PC Pin
Jassim Rahma11-Jun-14 4:19
Jassim Rahma11-Jun-14 4:19 
AnswerRe: Output to Promotion LCD from a PC Pin
OriginalGriff11-Jun-14 5:03
mveOriginalGriff11-Jun-14 5:03 
AnswerRe: Output to Promotion LCD from a PC Pin
Dave Kreskowiak11-Jun-14 7:49
mveDave Kreskowiak11-Jun-14 7:49 
AnswerRe: Output to Promotion LCD from a PC Pin
Chris Quinn11-Jun-14 21:17
Chris Quinn11-Jun-14 21:17 
QuestionWinForm DataGridView - Unable to convert MySql DateTime To System.DateTime Pin
Marnus Steyn11-Jun-14 4:14
Marnus Steyn11-Jun-14 4:14 
I Connect to a MySql Server from my C# Winform Application and I use a DataReader and the Convert Method to read a DateTime variable from the DB and convert it(No Errors).

DateTime date = Convert.ToDateTime(rdr["LastContacted"].ToString());


However when I wish to display the DateTime fields from my DB in a DataGridView
I receive the error "Unable to convert MySQL date/time value to System.DateTime".

//SELECT
string sql = "SELECT ID,";
if (chbxName.Checked) sql += "MemberName, ";
if (chbxSurname.Checked) sql += "MemberSurname, ";
if (chbxCellNumber.Checked) sql += "CellNumber, ";
if (chbxTellNumber.Checked) sql += "TellNumber, ";
if (chbxEmail.Checked) sql += "Email, ";
if (chbxStreetAdress.Checked) sql += "Street, ";
if (chbxSuburb.Checked) sql += "Suburb, ";
if (chbxCity.Checked) sql += "City, ";
if (chbxOccupation.Checked) sql += "Occupation, ";
if (chbxTitle.Checked) sql += "Title, ";
if (chbxInitials.Checked) sql += "Initials, ";
if (chbxDateJoined.Checked) sql += "DateJoined , ";
if (chbxDateResigned.Checked) sql += "DateResigned, ";
sql = sql.Remove(sql.Length - 2, 2); //Remove last comma

//FROM
if (Type == "resignedmembers")
    sql += " FROM resignedmembers";
else
    sql += " FROM members";

//WHERE
sql += " WHERE MemberType = '" + Type + "' AND " + FilterParameter + " LIKE '%" + txtFilterQuery.Text + "%' ";

MySqlDataAdapter daClients = new MySqlDataAdapter(sql, cnManageMembers);
daClients.Fill(dtClients);

BindingSource bsClients = new BindingSource();
bsClients.DataSource = dtClients;
dgvClients.DataSource = bsClients;
bnClients.BindingSource = bsClients;
dgvClients.Columns[0].ReadOnly = true;


How do I resolve this and do I resolve it in my Application or DB?

Thank you for your time. Smile | :)
AnswerRe: WinForm DataGridView - Unable to convert MySql DateTime To System.DateTime Pin
PIEBALDconsult11-Jun-14 4:54
mvePIEBALDconsult11-Jun-14 4:54 
GeneralRe: WinForm DataGridView - Unable to convert MySql DateTime To System.DateTime Pin
Marnus Steyn11-Jun-14 5:03
Marnus Steyn11-Jun-14 5:03 
GeneralRe: WinForm DataGridView - Unable to convert MySql DateTime To System.DateTime Pin
PIEBALDconsult11-Jun-14 5:29
mvePIEBALDconsult11-Jun-14 5:29 
GeneralRe: WinForm DataGridView - Unable to convert MySql DateTime To System.DateTime Pin
Marnus Steyn11-Jun-14 5:38
Marnus Steyn11-Jun-14 5:38 
GeneralRe: WinForm DataGridView - Unable to convert MySql DateTime To System.DateTime Pin
Bernhard Hiller11-Jun-14 20:43
Bernhard Hiller11-Jun-14 20:43 
GeneralRe: WinForm DataGridView - Unable to convert MySql DateTime To System.DateTime Pin
PIEBALDconsult12-Jun-14 2:39
mvePIEBALDconsult12-Jun-14 2:39 
QuestionGetNetworkUsageAsync() not working in Windows Store App on Windows 8.1 Pin
Sharath C V11-Jun-14 1:58
professionalSharath C V11-Jun-14 1:58 
AnswerRe: GetNetworkUsageAsync() not working in WindowsRT Pin
Pete O'Hanlon11-Jun-14 3:09
mvePete O'Hanlon11-Jun-14 3:09 
AnswerRe: GetNetworkUsageAsync() not working in WindowsRT Pin
Sharath C V11-Jun-14 3:34
professionalSharath C V11-Jun-14 3:34 
AnswerRe: GetNetworkUsageAsync() not working in WindowsRT Pin
Dave Kreskowiak11-Jun-14 3:12
mveDave Kreskowiak11-Jun-14 3:12 
GeneralRe: GetNetworkUsageAsync() not working in WindowsRT Pin
Sharath C V11-Jun-14 3:38
professionalSharath C V11-Jun-14 3:38 
AnswerRe: GetNetworkUsageAsync() not working in WindowsRT Pin
Sharath C V11-Jun-14 3:30
professionalSharath C V11-Jun-14 3:30 
QuestionWhy have insert new must command line "SET IDENTITY_INSERT TableName ON" save in SQL Server? Pin
Member 245846710-Jun-14 17:13
Member 245846710-Jun-14 17:13 
AnswerRe: Why have insert new must command line "SET IDENTITY_INSERT TableName ON" save in SQL Server? Pin
Mycroft Holmes10-Jun-14 18:02
professionalMycroft Holmes10-Jun-14 18:02 
AnswerRe: Why have insert new must command line "SET IDENTITY_INSERT TableName ON" save in SQL Server? Pin
Swinkaran10-Jun-14 18:37
professionalSwinkaran10-Jun-14 18:37 
AnswerRe: Why have insert new must command line "SET IDENTITY_INSERT TableName ON" save in SQL Server? Pin
Kornfeld Eliyahu Peter10-Jun-14 20:17
professionalKornfeld Eliyahu Peter10-Jun-14 20:17 
AnswerRe: Why have insert new must command line "SET IDENTITY_INSERT TableName ON" save in SQL Server? Pin
Kumarbs10-Jun-14 20:33
professionalKumarbs10-Jun-14 20:33 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.