Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > .NET 2.0 and Visual Studio. 2005 > .NET Framework 2.0
.NET Framework 2.0 For discussion of the Microsoft .NET Framework 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the .NET Framework 2.0 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old May 12th, 2006, 08:44 PM
Registered User
Join Date: May 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default error while moving code from dotnet1.1 to dotnet2.

Hello everyone,

can anyone plz help me in solving the problem i am facing....
i have vb.net code working fine with dotnet1.1 .now im moving my this code to dotnet2.0...and there i found error in my following code while communication with
SQL Server..........
the erroe was like this
"string to date conversion is not valid"
The code is here.......

 Public Function LoginUser() As Long
        Dim HostName As String = System.Net.Dns.GetHostName
        Dim HostIP As String = GetIPAddress()
        Dim cn As New SqlConnection(connString)
        Dim cmd As New SqlCommand
            cmd.Connection = cn
            cmd.CommandText = "INSERT INTO [Login_History] (User_Id,Date_In,Store_Id,Host_Name,Host_IP) VALUES (" & Users.CurrentlyLoggedInUser.UserID & ",'" & CDate(Format(DateTime.Now.ToString, "yyyy/MM/dd [H:mm:ss]")) & "'," & Users.CurrentStoreID & ",'" & HostName & "','" & HostIP & "')"
            cmd.CommandText = "SELECT @@IDENTITY"
            LoginUser = CheckLongForDBNull(cmd.ExecuteScalar)
        Catch x As Exception
            MsgBox(x.ToString & " " & x.StackTrace)
        End Try
    End Function

Old May 16th, 2006, 03:59 PM
Friend of Wrox
Join Date: Jun 2003
Posts: 217
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to mega

Is it web or windows application?

 - mega
Moving to C# .NET

Similar Threads
Thread Thread Starter Forum Replies Last Post
Unable to reference to dlls dotNet1.1 jdang67 .NET Framework 2.0 2 December 5th, 2005 11:55 AM
Error after moving to new SQL server jackchua BOOK: ASP.NET Website Programming Problem-Design-Solution 1 May 29th, 2005 07:47 PM
Moving code to new server sporkman43 Crystal Reports 0 August 2nd, 2004 02:05 PM
moving a button in code goplayoutside VB.NET 2002/2003 Basics 2 April 22nd, 2004 01:40 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.