IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

VB.NET Discussion :

Syntax error converting the varchar value '5.2 (3790)' to a column of data type int


Sujet :

VB.NET

  1. #1
    Membre du Club
    Inscrit en
    Décembre 2006
    Messages
    158
    Détails du profil
    Informations forums :
    Inscription : Décembre 2006
    Messages : 158
    Points : 56
    Points
    56
    Par défaut Syntax error converting the varchar value '5.2 (3790)' to a column of data type int
    Bonjour tout le monde,
    voilà hier à peine mon application fonctionnait à merveil, et maintenat je reçois ce type de message d'erreur
    Syntax error converting the varchar value '5.2 (3790)' to a column of data type int

    là je ne comprends vraiment plus rien je suis au bord de la crise de nerf
    Si quelqu'un veut bien jeter un coup d'oeil et me donner son avis cela serait vraiment très gentil. Merci milles fois.
    Bien à vous.
    Ps: l'erreur ce situe à la ligne 101
    Source Error:


    Line 99:
    Line 100: Dim objCommand As New SqlCommand(sqlQuery, objConnect)
    Line 101: a = objCommand.ExecuteNonQuery()
    Line 102: Return a
    Line 103:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
     
    <%@ Page Language="VB" %>
    <%@ Register TagPrefix="wmx" Namespace="Microsoft.Matrix.Framework.Web.UI" Assembly="Microsoft.Matrix.Framework, Version=0.6.0.0, Culture=neutral, PublicKeyToken=6f763c9966660626" %>
    <%@ import Namespace="System.Data" %>
    <%@ import Namespace="System.Data.SqlClient" %>
    <%@ import Namespace="System.Web.Mail" %>
    <%@ import Namespace="System.IO" %>
    <%@ import Namespace="System.DirectoryServices" %>
    <%@ import Namespace="System.Configuration" %>
    <%@ import Namespace="System.Net" %>
    <%@ import Namespace="System" %>
    <%@ import Namespace="System.Net.DNS" %>
    <%@ import Namespace="System.ComponentModel" %>
    <%@ import Namespace="System.Management" %>
    <%@ import Namespace="System.Runtime.InteropServices" %>
    <%@ import Namespace="System" %>
    <%@ import Namespace="ActiveDs" %>
    <%@ import Namespace="System.Text" %>
    <%@ import Namespace="System.Net.NetworkInformation" %>
    <%@ import Namespace="System.Net.Sockets" %>
    <script runat="server">
     
        ' Insert page code here
             '
     
     
              Sub Page_Load()
     
     
                     Dim Ldap As DirectoryEntry = New DirectoryEntry("LDAP://tamac.local", "toto", "toto")
                     Dim searcher As DirectorySearcher = New DirectorySearcher(Ldap)
                     searcher.Filter = "(objectClass=computer)"
                     Dim DirEntry As DirectoryEntry
                     Dim nom As String
                     Dim OsVersion As String
                     Dim Os As String
                     Dim ServicePack As String
                     Dim Ip As String
                     Dim largeInteger As Object
                     Dim lastLoggedOnDate As Date
                     Dim reboot As Date
                     Dim rebootTime As Object
     
                     SqlDataSourceControl2.ConnectionString="server='(local)'; trusted_connection=true; database='pspintranet'"
                     SqlDataSourceControl2.SelectCommand="Select * from Servers"
     
     
                     call SQLExecuteQuery("TRUNCATE TABLE Servers")
     
     
                     For Each result As SearchResult In searcher.FindAll
     
                      DirEntry = result.GetDirectoryEntry
                       'Response.Write("Nom : " + DirEntry.Properties("Name").value)
                       'Response.write("Os_version : " + DirEntry.Properties("operatingSystemVersion").value)
                       'Response.write(" Os : " + DirEntry.Properties("operatingSystem").value)
                       'Response.write("ServicePack :" + DirEntry.Properties("operatingSystemServicePack").value)
                        'Response.write("userPrincipalName :" + DirEntry.Properties("userPrincipalName").value)
     
     
                      nom = DirEntry.Properties("Name").value
                      'insertion des ip dans la DB.
                      Dim IPHost As IPHostEntry = Dns.Resolve(DirEntry.Properties("Name").value)
                      Dim addressList As IPAddress() = IPHost.AddressList
                      Dim b As IPAddress = addressList(0) ' récupère la première adresse
                      Ip = b.ToString()
                      OsVersion    =  DirEntry.Properties("operatingSystemVersion").value
                      Os           =   DirEntry.Properties("operatingSystem").value
                      ServicePack  =    DirEntry.Properties("operatingSystemServicePack").value
                      'reboot = restart(rebootTime)
                      'call restart()
     
                      'lastLoggedOnDate = ConvertLargeIntToDate(largeInteger)
                      'largeInteger = DirEntry.Properties("lastLogOn").Value
                      'lastLoggedOnDate = ConvertLargeIntToDate(largeInteger)
                      'last_logon = lastLoggedOnDate
     
     
                      'lblError.Text += nom & " - " & OsVersion & " - " & Os & " - " & ServicePack & "<br>"
                           'Dim IPHost As IPHostEntry = Dns.Resolve(DirEntry.Properties("Name").value)
                           'Dim addressList As IPAddress() = IPHost.AddressList
                           'Dim a As IPAddress = addressList(0) ' récupère la première adresse
     
                      'lblError.Text += "INSERT INTO Servers (nom,Ip,ServicePack,OsVersion,OsName) VALUES('"& nom &"','" & Ip & "','" & ServicePack &"','" & OsVersion &"', '" &  Os  &"' )" & "<br>"
                      call SQLExecuteQuery("INSERT INTO Servers (nom,Ip,ServicePack,OsVersion,OsName) VALUES('"& nom &"','" & Ip & "','" & ServicePack &"','" & OsVersion &"', '" &  Os  &"' )")
     
                      Next
     
                      MxDataGrid1.DataBind()
     
     
             End Sub
     
             Function SQLExecuteQuery(ByVal sqlQuery As String) As String
     
                      Dim a As String
     
                      Dim objConnect As New SqlConnection("server='(local)'; trusted_connection=true; database='pspintranet'")
                      objConnect.Open()
     
                      Dim objCommand As New SqlCommand(sqlQuery, objConnect)
                      a = objCommand.ExecuteNonQuery()
                      Return a
     
             End Function
     
     
             Private Function ConvertLargeIntToDate(ByVal largeInteger As Object) As Date
                   Dim typ As Type = largeInteger.GetType()
                   Dim highPart As Integer = CInt(typ.InvokeMember("HighPart", Reflection.BindingFlags.GetProperty, Nothing, largeInteger, Nothing))
                   Dim lowPart As Integer = CInt(typ.InvokeMember("LowPart", Reflection.BindingFlags.GetProperty, Nothing, largeInteger, Nothing))
                   Dim fileTime As Int64 = Convert.ToInt64(highPart * (2 ^ 32))
                   Return (DateTime.FromFileTime(fileTime))
               End Function
     
     
     
     
             Sub Button1_Click(sender As Object, e As EventArgs)
              'txtPing.Text = Nothing
              'pingopts.Ttl = Convert.ToInt32(txtTTL.Text)
     
             Dim ping As Ping = New Ping()
             Dim pingreply As PingReply = ping.Send(TextBox1.Text)
                 response.write("Reply from : " & TextBox1.Text)
                 Response.Write("<br>")
                 Response.Write("<br>")
                 response.write("Time :" & pingreply.RoundtripTime)
                 Response.Write("<br>")
                 Response.Write("<br>")
                 'response.write("TTL :" &  Pingreplay.Ttl.ToString())
                 'Response.Write("<br>")
                 'Response.Write("<br>")
                 response.write("Buffer Size :" & pingreply.Buffer.Length.ToString())
                 Response.Write("<br>")
                 Response.Write("<br>")
     
     
     
     
     
             End Sub
     
    </script>
    <html>
    <head>
    </head>
    <body>
        <form runat="server">
            <p>
                <wmx:SqlDataSourceControl id="SqlDataSourceControl2" runat="server" UpdateCommand="" DeleteCommand=""></wmx:SqlDataSourceControl>
                <wmx:MxDataGrid id="MxDataGrid1" runat="server" BorderStyle="None" BorderWidth="1px" BorderColor="#CCCCCC" BackColor="White" DataMember="Servers" DataSourceControlID="SqlDataSourceControl2" DataKeyField="nom_id" CellPadding="3" AllowSorting="True" AllowPaging="False">
                    <FooterStyle backcolor="White" forecolor="#000066"></FooterStyle>
                    <HeaderStyle backcolor="#006699" font-bold="True" forecolor="White"></HeaderStyle>
                    <ItemStyle forecolor="#000066"></ItemStyle>
                    <PagerStyle mode="NumericPages" horizontalalign="Center" backcolor="White" forecolor="#000066"></PagerStyle>
                    <SelectedItemStyle backcolor="#669999" font-bold="True" forecolor="White"></SelectedItemStyle>
                </wmx:MxDataGrid>
                <asp:Label id="lblError" runat="server"></asp:Label>
            </p>
            <p>
            </p>
            <p>
            </p>
            <p>
            </p>
            <p>
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                <asp:TextBox id="TextBox1" runat="server"></asp:TextBox>
            </p>
            <p>
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                <asp:Button id="Button1" onclick="Button1_Click" runat="server" Text="Ping"></asp:Button>
            </p>
        </form>
    </body>
    </html>

  2. #2
    Membre du Club
    Inscrit en
    Décembre 2006
    Messages
    158
    Détails du profil
    Informations forums :
    Inscription : Décembre 2006
    Messages : 158
    Points : 56
    Points
    56
    Par défaut
    Problème résolu je crois que c'est cette application qui me monte à la tête par moment j'ai grand besoin de prendre l'air, ça va me changer les idées

    En tout cas un grand merci pour votre aide
    Bien à vous.

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Réponses: 2
    Dernier message: 16/03/2011, 17h04
  2. Réponses: 1
    Dernier message: 02/07/2010, 16h50
  3. Syntax error converting datetime from character string
    Par amirad dans le forum Développement
    Réponses: 6
    Dernier message: 15/05/2009, 10h09
  4. [SQL SERVER] Syntax error converting the varchar value
    Par freud dans le forum Bases de données
    Réponses: 2
    Dernier message: 23/07/2007, 17h51
  5. Syntax error converting character string to smalldatetime data type.
    Par Anthony.Desvernois dans le forum MS SQL Server
    Réponses: 2
    Dernier message: 05/07/2007, 17h26

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo