Jump to content
UBot Underground

Unable to convert MySQL date/time value to System.DateTime


Recommended Posts

post-9945-0-52974400-1406659603_thumb.png

 

I'm inserting a record into a database.

 

The record has 2 date fields and they get inserted correctly, however I get this error message after the insert.

 

Any ideas?

Link to post
Share on other sites

This is how I do it for the current date/time.

 

MySQL table:

 

CREATE TABLE MailingInProcess (
  ID                   int AUTO_INCREMENT NOT NULL,
  MailingName          varchar(50) NOT NULL COMMENT 'Mailing Name',
  MailAccountUsername  varchar(100) NOT NULL COMMENT 'Mail Account Username',
  MailAccountPassword  varchar(50) NOT NULL COMMENT 'Mail Account Password',
  MailConnectionType   varchar(50) NOT NULL COMMENT 'Mail Connection Type',
  MailServer           varchar(100) NOT NULL COMMENT 'Mail Server',
  MailServerPort       int NOT NULL COMMENT 'Mail Server Port',
  Email                varchar(150) COMMENT 'Email',
  Source               varchar(50) NOT NULL COMMENT 'Source',
  Industry             varchar(50) NOT NULL COMMENT 'Industry',
  State                varchar(50) NOT NULL COMMENT 'State',
  SentFrom             varchar(100) DEFAULT ' ' COMMENT 'Sent From',
  SubjectText          varchar(100) DEFAULT ' ' COMMENT 'Subject Text',
  BodyText             varchar(1700) DEFAULT ' ' COMMENT 'Body Text',
  CreatedDate          timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP  'Created Date',
  DateMailed           timestamp 'Date Mailed',
  /* Keys */
  PRIMARY KEY (ID)
) ENGINE = InnoDB;

 

UBOT Studio UPDATE:

 

define UpdateMailer {
    set(#IDtoUpdate$table cell(&OneMailer, 0, 0), "Global")
    set(#MailerUpdateQuery"UPDATE MailingInProcess SET DateMailed = Current_Timestamp WHERE ID = {#IDtoUpdate};""Global")
    plugin command("DatabaseCommands.dll""connect to database"#ConnectionString) {
        plugin command("DatabaseCommands.dll""query"#MailerUpdateQuery)
    }
}

 

 

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...