Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Weird behavior with a Time field
Message
From
10/09/2010 00:03:46
 
 
To
All
General information
Forum:
ASP.NET
Category:
Other
Title:
Weird behavior with a Time field
Environment versions
Environment:
VB 9.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01480749
Message ID:
01480749
Views:
95
I have this method which is used to return the data type of a field:
        ' Return a property of a field
        ' expC1 Field
        Public Function GetColumnProperty(ByVal tcField As String) As String
            Dim lcFieldName As String = ""
            Dim llSuccess As Boolean = False
            Dim lnColumnSize As Integer = 0
            Dim loObject As Object = ""
            Dim loRow As DataRow

            ' Trim just in case
            tcField = Trim(tcField)

            ' Locate the field
            For Each loRow In oDataTable.Rows
                lcFieldName = loRow("ColumnName")

                ' If this is the field
                If UCase(lcFieldName) = UCase(tcField) Then
                    loObject = loRow(tcProperty)

                    ' Just in case we need it down below
                    lnColumnSize = loRow("ColumnSize")

                    llSuccess = True
                    Exit For
                End If

            Next

            ' If the property is DataType
            If UCase(tcProperty) = "DATATYPE" Then
                lcType = loObject.ToString
            End If

            Return lcType
        End Function
When I pass a field which is a Type, when this field is coming from SQL Anywhere, the data type is known as String. So, of course, when I use that type in a query for a parameter definition, it would cause an erro.

I create oDataTable like this:
loConnection = New OdbcConnection(oConnectionOpenManually.cConnectionString)
loConnection.Open()
oCommand = New OdbcCommand
oCommand.Connection = loConnection
oCommand.CommandText = "Select * From " + tcTable
oDataReader = oCommand.ExecuteReader(CommandBehavior.SchemaOnly)
oDataTable = oDataReader.GetSchemaTable
oDataReader.Close()
Anyone would know if it is normal that a datatype Time would be known as a String? Because, I have no way presently to tell the framework to define the data type properly to a Time in order to have my parameterized query to be properly defined.
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Reply
Map
View

Click here to load this message in the networking platform