List:MySQL and .NET« Previous MessageNext Message »
From:Reggie Burnett Date:November 17 2004 8:51pm
Subject:RE: Installer & MySqlDateTime
View as plain text  
Shawn

Those already exist.  There is an IsValidDateTime property that returns true
if it is a valid DateTime.  Also, there is a method named GetDateTime that
will return a DateTime if it can.

-reggie

> -----Original Message-----
> From: SGreen@stripped [mailto:SGreen@stripped]
> Sent: Wednesday, November 17, 2004 2:25 PM
> To: Joshua Mouch
> Cc: dotnet@stripped
> Subject: Re: Installer & MySqlDateTime
> 
> (Reggie just went over this a few posts ago or I wouldn't have known the
> answer)
> 
> Because MySQL allows for datetimes that are "illegal" for .Net Date types
> (year 0, February 31st, '0000-00-00', etc) he had to create a new return
> type for those fields that didn't inherit from the base Date type.
> 
> Using toString() will probably be the most portable way of dealing with
> MySQL date values until we can all agree on a method of handling those
> date values that are valid for MySQL but out-of-range for .Net.
> 
> My idea would be to expose a .NetDate property (a read/write Date object)
> from his new class that will be populated with a valid .Net Date object if
> one could exist. It would contain nothing for out of bound values. A
> second property (.OutOfBounds) would be true if this were an out of bounds
> value. You could always set the internal MySQL date value with a string
> value even if you couldnt use a Date object.
> 
> Any other ideas?
> 
> Shawn Green
> Database Administrator
> Unimin Corporation - Spruce Pine
> 
> 
> 
> "Joshua Mouch" <joshua@stripped> wrote on 11/17/2004 01:56:18 PM:
> 
> > Oh, I thought that VS.Net installed a shell extension that automatically
> did
> > that when you copied via Explorer.
> >
> > On a different note, it seems that some code was broken from the upgrade
> > from 1.01 to 1.02.  It appears that the connector returns a
> MysqlDateTime
> > type for a date column.  It appears that this cannot be converted to a
> .Net
> > Date type.  Here's the error:
> >
> > "Conversion from type 'MySqlDateTime' to type 'Date' is not valid."
> >
> > I'm not sure the best way to approach this.  I can probably convert it
> to a
> > string and then parse it to a Date type.
> >
> > Joshua Mouch
> > EmailScout Support Team
> > http://www.emailscout.net
> >
> >
> > -----Original Message-----
> > From: Ben Reichelt [mailto:ben.reichelt@stripped]
> > Sent: Wednesday, November 17, 2004 1:27 PM
> > To: Joshua Mouch
> > Subject: Re: Installer
> >
> > In order to use an assembly from the GAC, you cant just copy it there,
> > you need to tell the GAC that you're putting it there as well.  If you
> > use the gacutil.exe command line utility, which is in the your .net
> > framework directory, you can register an assembly in the GAC.  here is
> > an example:
> >
> > C:\>gacutil.exe -i "C:\Program Files\MySql\MySql Connector\bin\.NET
> > 1.1\MySql.Data.dll"
> >
> > the "-i" flag tells gacutil to install the assembly, you can use the
> > "-u" flag to uninstall an assembly from the GAC.
> >
> > hope this helps
> >
> > ben
> >
> >
> > On Wed, 17 Nov 2004 13:18:19 -0500, Joshua Mouch <joshua@stripped>
> > wrote:
> > > It'd be nice if the installer put the connector into the GAC
> > automatically.
> > > Every release seems to install to a different directory, and I have to
> go
> > > through all my projects to change the reference paths. :P
> > >
> > > Which brings me to a question...
> > > I copied the mysql connector dll to the assembly directory under
> Windows.
> > > When I look in the GAC directory, I see the Mysql.Data.dll file there,
> but
> > > for some reason, it doesn't show up when adding a reference to a
> project
> > > from within Visual Studio.  All of the other GAC assemblies are there,
> but
> > > not Mysql.Data.dll.  Anybody else experienced this, or is my machine
> just
> > > messed up?  :-)
> > >
> > > Joshua Mouch
> > > EmailScout Support Team
> > > http://www.emailscout.net
> > >
> > > -----Original Message-----
> > > From: Jordan Sparks [mailto:jsparks@stripped]
> > > Sent: Wednesday, November 17, 2004 1:02 PM
> > > To: dotnet@stripped
> > > Subject: RE: Last insert autoincrement id value with VB.NET
> > >
> > > I don't know of one.  But remember that you can simply build a
> function
> > > to encapsulate that behavior.  For instance, I have:
> > >
> > >                 public int NonQ(string command){
> > >                         return NonQ(command,false);
> > >                 }
> > >
> > >                 public int NonQ(string command,bool getInsertID){
> > >                         cmd.CommandText=command;
> > >                         int rowsChanged=0;
> > >                         try{
> > >                                 con.Open();
> > >                                 rowsChanged=cmd.ExecuteNonQuery();
> > >                                 if(getInsertID){
> > >                                         cmd.CommandText="SELECT
> > > LAST_INSERT_ID()";
> > >
> > > dr=(MySqlDataReader)cmd.ExecuteReader();
> > >                                         if(dr.Read())
> > >
> > > InsertID=PIn.PInt(dr[0].ToString());
> > >                                 }
> > >                         }
> > >                         catch(MySqlException e){
> > >                                 MessageBox.Show("Error:
> > > "+e.Message+","+cmd.CommandText);
> > >                         }
> > >                         //catch{
> > >                         //      MessageBox.Show("Error: "+);
> > >                         //}
> > >                         finally{
> > >                                 con.Close();
> > >                         }
> > >                         return rowsChanged;
> > >                 }
> > >
> > > I know it's C#, but you should be able to follow it.  Basically, the
> > > second function does all the work, but is overloaded in the first
> > > function.  So, throughout my code, I can either call
> > > DataConnection.NonQ("some string"), or I can call
> > > DataConnection.NonQ("some string",true).  Then DataConnection.InsertID
> > > will contain the last increment id.  I'm sure my function above could
> be
> > > a little more elegant, but it get's the job done.
> > >
> > > Jordan Sparks
> > >
> > > -----Original Message-----
> > > From: Ville Mattila [mailto:ville@stripped]
> > > Sent: Wednesday, November 17, 2004 5:06 AM
> > > To: dotnet@stripped
> > > Subject: Last insert autoincrement id value with VB.NET
> > >
> > > Hello,
> > >
> > > I was wondering if there is a function on Connector/.NET to receive
> > > easily the value of the auto increment id from the latest inserted
> row.
> > > Or is the only possibility to execute another query (SELECT
> > > LAST_INSERT_ID()) ?
> > >
> > > Thanks,
> > > Ville
> > >
> > > --
> > > MySQL on .NET Mailing List
> > > For list archives: http://lists.mysql.com/dotnet
> > > To unsubscribe:
> > > http://lists.mysql.com/dotnet?unsub=1
> > >
> > > --
> > > MySQL on .NET Mailing List
> > > For list archives: http://lists.mysql.com/dotnet
> > > To unsubscribe:
> > http://lists.mysql.com/dotnet?unsub=1
> > >
> > > --
> > > MySQL on .NET Mailing List
> > > For list archives: http://lists.mysql.com/dotnet
> > > To unsubscribe:
> > http://lists.mysql.com/dotnet?unsub=1
> > >
> > >
> >
> >
> > --
> > MySQL on .NET Mailing List
> > For list archives: http://lists.mysql.com/dotnet
> > To unsubscribe:    http://lists.mysql.com/dotnet?unsub=1
> >

Thread
Installer & MySqlDateTimeJoshua Mouch17 Nov
  • Re: Installer & MySqlDateTimeSGreen17 Nov
    • RE: Installer & MySqlDateTimeReggie Burnett17 Nov
      • RE: Installer & MySqlDateTimeSGreen18 Nov
    • RE: Installer & MySqlDateTimeJames Moore18 Nov
      • RE: Installer & MySqlDateTimeJoshua Mouch18 Nov
        • RE: Installer & MySqlDateTimeReggie Burnett18 Nov
          • RE: Installer & MySqlDateTimeJames Moore18 Nov
      • RE: Installer & MySqlDateTimeReggie Burnett18 Nov