Help: MySQL Time Type Null (ODBC.NET) Urgent ! ! !

Hi, All

In my web application, I'm using MySQL 4.0.21 (mysqld-max-nt)+ASP.NET 1.1 (SP1)+ODBC.NET + MyODBC 3.15.09 @window 2000 SP4 (tried 2000 standard server & professional with same error)
MDAC 2.80
I have following error:
I have a table named 'SHIFT':
CREATE TABLE `shift`
(
`SHIFT_ID` tinyint(3) unsigned NOT NULL default '0',
`SHIFT_CODE` varchar(10) NOT NULL default ''
`SHIFT_STARTTIME` time NOT NULL default '00:00:00',
`SHIFT_ENDTIME` time NOT NULL default '00:00:00',
`SHIFT_MIDDLETIME` time NOT NULL default '00:00:00',
`SHIFT_HALF_END` time NOT NULL default '00:00:00',
`SHIFT_HALF_START` time NOT NULL default '00:00:00'
PRIMARY KEY (`SHIFT_ID`),UNIQUE KEY `CODE` (`SHIFT_CODE`)
) TYPE=MyISAM
having following data
1 SHIFT A 07:00:00 15:00:00 11:00:00 10:45:00 11:15:00
2 SHIFT B 15:00:00 23:00:00 19:00:00 18:45:00 19:15:00
3 SHIFT C 23:00:00 07:00:00 03:00:00 02:45:00 03:15:00
4 NORMAL 8:00:00 17:30:00 12:00:00 12:00:00 13:00:00

I try to using ODBC command to get data:

Public Function GetShiftTime(ByRef sMessage As String, _
ByVal ShiftID As Long, _
ByRef ShiftStart As TimeSpan, _
ByRef ShiftEnd As TimeSpan, _
ByRef ShiftHalf As TimeSpan, _
ByRef ShiftHalfEnd As TimeSpan, _
ByRef ShiftHalfStart As TimeSpan) As Long
Dim nResult As Long = 0
sMessage = ""
Try
If MyConnection.State <> ConnectionState.Open Then MyConnection.Open()
Dim sQueryString As String = "SELECT SHIFT_STARTTIME AS STARTTIME, " _
& "SHIFT_ENDTIME AS ENDTIME, SHIFT_MIDDLETIME AS HALFTIME, " _
& "SHIFT_HALF_END AS SHIFTHALFEND, SHIFT_HALF_START AS SHIFTHALFSTART " _
& "FROM SHIFT WHERE SHIFT_ID='@SHIFTID@';"
sQueryString = sQueryString.Replace("@SHIFTID@", ShiftID)
Dim myAdapter As New OdbcDataAdapter(sQueryString, MyConnection)
Dim ShiftDT As New DataTable
myAdapter.Fill(ShiftDT)
With ShiftDT
If .Rows.Count > 0 Then
If .Rows.Count = 1 Then
ShiftStart = .Rows(0).Item(0)
ShiftEnd = .Rows(0).Item(1)
ShiftHalf = .Rows(0).Item(2)
ShiftHalfEnd = .Rows(0).Item(3)
ShiftHalfStart = .Rows(0).Item(4)
nResult = ShiftID
Else
sMessage = "Cannot Find Matched ShiftID/Duplicated ShiftID in Shift Table!"
End If
Else
sMessage = "No Record In Shift Table!"
End If
End With
Catch ex As Exception
sMessage = ex.Message
nResult = -1
Finally
MyConnection.Close()
End Try
Return nResult
End Function
Debug mode, system will throw exception when access
ShiftStart = .Rows(0).Item(0)
I checked ShiftDT.Row(0).Item(0) under immediate window. The result is DBNull.
While using mysql, I run the same SQL
SELECT SHIFT_STARTTIME AS STARTTIME, SHIFT_ENDTIME AS ENDTIME, SHIFT_MIDDLETIME AS HALFTIME, SHIFT_HALF_END AS SHIFTHALFEND,
SHIFT_HALF_START AS SHIFTHALFSTART
FROM SHIFT WHERE SHIFT_ID='1';
I can get the correct data:
7:00:00 15:00:00 11:00:00 10:45:00 11:15:00

I guess it's because of ODBC cast time to timespan error.
Please help to give me a hand.
0
huihui_sg
10/2/2004 6:23:47 AM
asp.net.mysql 1929 articles. 0 followers. Follow

1 Replies
546 Views

Similar Articles

[PageSpeed] 34

Please do NOT use MyODBC 3.51.09. There's a bug in converting Time Type: converted to DBNull or '00:00:00';

MyODBC 3.51.06 is working fine.
0
huihui_sg
10/4/2004 2:49:36 AM
Reply:

Similar Artilces:

MySQL
Currently have a site coded in PHP but the customer wants to go to .NET. Can I use the existing MySQL DB or am I required to use MSSQL? Thanks, Ken Check out this forum which is specialized for this kind of questions: ASP.NET MySQL forumBart De Smet [MVP] Visit www.msdn.be, www.bartdesmet.net...

Differnet access time of MySQL Connector.Net in Desktop and IIS Application -- Need help
Hi I am using MySQL Connector.Net in my web application (.Net 3.5). I found that each query takes ~250 ms in my application. When I tried to run the same query from a Desktop application I found that the time ~80ms. Is there any way for tuning the IIS or what I am missing here? If I could get the same speed as desktop application in my web application, my app would be 2X faster than current. Thanks in advance for your help....

HELP! using mysql .net ODBC data provider as backend for excel 2000 automation..
Ok, here's the deal. I am trying very hard to use MySQL as a backend for ASP.NET development (which works fine), and trying to create a reporting section that generates excel reports using Excel 2000. Has anyone tried this and is it feasible. Needless to say I am running into all sorts of problems. The MySQL odbc .net provider works fine and is able to connect to the database. for all other regular asp.net programming. eg. populating listboxes, databinding the datagrids, datasets etc. works perfectly. Enter excel 2000 reports; I have tried automating this through ASP.NET but it gives m...

System.Net.Sockets.SocketException with MySQL Connector.NET
Hi. I already tried many things and spent already 2 days without any success. Please help or I'll hang myself.I am using MySql.Data.dll  ver. 5.2.5.0 (runtime v2.0.50727) from my project (library). It works great if i use it from WindowsApplication but once i use it same way in WebApplication, it keeps throwing: The attempted operation is not supported for the type of object referencedException Details: System.Net.Sockets.SocketException: The attempted operation is not supported for the type of object referenced .. AsyncResult ias = socket.BeginConnect(endPoint, null, null);.. (or w...

mysql and .net
Hi there, i am new to .net and i am trying to setup a simple form. I am an open source person and what i am asking can be done easily using php and mysql; but i need to know how to do this in .net project asap. i have three forms; form1 submit to the database and redirect to form2 and form2 submit to the database and redirect to form3. i want to grab mysql last inserted id from form1 to form2 while redirecting and pass it via the url. i am able to select from the database, but i don't know how to assign it to a variable; here is what i have so far: str2 = "select last_ins...

Net::MySQL
------=_NextPart_000_0026_01C30A6E.486AE070 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Anyone run into this problem=20 $mysql->query(q{ INSERT INTO dbname (table_name) VALUES ( $var ) }); The problem is, when I assign a value to a $var that value is ignored in = the SQL statement. Ive tried every operator I know to get it to look at = it and accept the value as input into the DB. Ive tried=20 ( '$var' ) ("$var") ("\$var") ([$var]) ({$var}) Any ideas ? Kind regards...

ERROR [HY000] [MySQL][ODBC 3.51 Driver]Can't connect to MySQL server on 'IP Address of the server'(10048) ERROR [HY000] [MySQL][ODBC 3.51 Driver]Can't connect to MySQL server on 'IP of the server' (10
Hi, I am randomly getting the following error message in my application. ERROR [HY000] [MySQL][ODBC 3.51 Driver]Can't connect to MySQL server on 'IP Address of the server'(10048) ERROR [HY000] [MySQL][ODBC 3.51 Driver]Can't connect to MySQL server on 'IP of the server' (10048) I am using .Net 2.0 with VS2005 having ODBC 3.51.14 Driver.  Can any body point out the core reasons of the above error message? Thanks. Nouman Khawaja. I do have the same problem, help me out. Thanks  If the going seems easy, You are going DownHill... When I was writing ...

Problems connecting to MySQL through MyODBC using ODBC.NET
Help ! Another learner... I am trying to connect to mySQL through MyODBC using ODBC.NET and have the following setup on a W2K machine.... 1. mySQL 4.0.15 database up and running (visible in Services). The DB is definitely there (I can see its contents through MySQL CC) 2. I have installed MySQL ODBC 3.51 Driver and created a User DSN called myDSN. I can connect to the database via the 'Test Data Source' (at least its telling me that I've connected...) 3. Using WebMatrix, I have the following declarations in place : <%@ Page Language="VB" Debug="true" Com...

Type.GetType does not work in VB.NET but works in C#. VB.NET gurus Please help
Friends,   I am an experienced C# programmer who is working on a VB.NET project now. I am writing different methods covering the following functionalities 1) Take a datareader as input and return an arraylist of class object2) Take an xmlnode (received from a webservice) as input and return an arraylist of class object. The methods are generic methods which take datareader/xmlnode as first parameter and classname (string) as the second parameter. This way it will work trivially. The schema of class object matches with the input (datareader or xmlnode)In C# I used to do th...

mySQL connector/net will work in development but not on webserver...help
hello, i got mySQL connector/net v6.0 to finally work on my development computer.  I uploaded the asp/vb page to my webserver, along with an added assembly reference in my web.config and updated the bin folder on the webserver, however i am gettting the error 'MySqlCommand' is ambiguous in the namespace 'MySql.Data.MySqlClient'. anyone know how i can fix this? my web.config looks like this   <assemblies>     <add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>   ...

Changing MySQL connection from .net component to ODBC
Hi there, we've completed our project and managed to run everything smoothly locally. However, when we uploaded all of the files online on our domain, it turns out that the database connection we used from MySQL to ASP.net is NOT SUPPORTED by our host. We are currently using the .net MySQL Component. Our host only supports ODBC connection. We could change all our files and change the lines that uses that .net MySQL component to ODBC, however, that would take so much time that we don't have. Anyone has any suggestions? If no one does then I think it's best to re...

connection Mysql C#.net in web.config problem help
 webconfig this code <connectionStrings> <add name="planku" connectionString="Server=localhost;user id=root;password=;database=planku;" providerName="mysql.data.mysqlclient"/></connectionStrings> <system.web><sessionState timeout="60" cookieless="AutoDetect" regenerateExpiredSessionId="true"/> <compilation debug="true" strict="false" explicit="true"><assemblies> <add assembly="System.Design, Version=2.0.0.0, Culture=neutral, Publ...

Net:Net:Net::LDAP::FAQ
------_=_NextPart_001_01C6429F.D89AA417 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hello, Net::LDAP Net::LDAPS Is there a possible to LDAP bind with an encrypted (SHA, SSHA, CRYPT, ....) password? I don't like to write the secret password to the perl file. Best regards Barbara Wilbert ------_=_NextPart_001_01C6429F.D89AA417-- Wilbert Barbara (CI/OSI) * wrote: > Hello, > > Net::LDAP > Net::LDAPS > > Is there a possible to LDAP bind with an encrypted (SHA, SSHA, CRYPT, > ......

Possible to connect the SqlDatasource with MySQL Connector/NET or is a ODBC driver required?
 Hi, I am using the MySQL Connector/NET 5.2.5.0 right now to use all the membersip stuff with my MySQL 5.0 database and it works great. Now I want to test this example http://www.asp.net/learn/videos/video-07.aspx (databinding a gridview to a datasource and enable editing) with my new MySQL-Connection. But when I want to choose a connection for my SqlDataSource there is no connection listed even though I have a connection in my web.config which already works with the membership stuff. This is my connection string: 1 <connectionStrings>2 <add na...

Web resources about - Help: MySQL Time Type Null (ODBC.NET) Urgent ! ! ! - asp.net.mysql

What is the Big Bang Theory?
How was our Universe created? How did it come to be the seemingly infinite place we know of today? And what will become of it, ages from now? ...

Former NBA Player Shawne Williams Arrested On Many Charges After Hit-and-Run
Shawne Williams, 17th overall pick in the 2006 NBA Draft, was arrested last night on a multitude of charges stemming from a car accident in Memphis. ...

Windows 10 mobile update delayed to beginning of 2016
Despite forecasting a rollout of the Windows 10 smartphone update in December several months ago, Microsoft now says the upgrade will take place ...

Trump Flashback: Hillary 'A Great Appointment,' Obama EPA Appointment 'Brilliant Person, A Great Environmental ...
In 2008, Donald Trump, the current Republican presidential frontrunner, said, "Hillary is a great appointment," and called EPA administrator ...

Rubio, Cruz and U.S. Global Leadership
At some point between 20016 and 2008, the American people decided to turn their backs on the world. Between the seeming futility of the war in ...

Apple’s secret design studio and new ‘Apple store of the future’ to be featured on ’60 Minutes’
Of all the secretive enclaves within Apple , none is more hallowed than Apple's notoriously quarantined design studio. Run by Jony Ive, Apple's ...

DNC Suspends Bernie Sanders Campaign from Data Access After Breach into Clinton Records
Bernie Sanders’ campaign improperly gained access to Hillary Clinton’s confidential voter information while a software patch was being applied ...

Facebook Tests “Click For More” To Boost Video Views On Desktop
Facebook says it now gets around 8 billion video views on its platform each day, and the social network has made no secret of its plans to make ...

Lifelock admits it lied in its ads (again), agrees to $100M fine
Lifelock, the tragicomically awful identity-theft protection service, has settled the FTC's suit against it , agreeing to pay a $100M fine for ...

‘Vikings’ Season 4: History Channel Announces Premiere Date, Double The Episodes & A Split Season
Fans of History Channel’s Vikings finally gets a start date for season 4 for the series based on the viking sagas and legends. As well as the ...

Resources last updated: 12/18/2015 2:46:43 PM