Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB How-To
|
VB How-To Ask your "How do I do this with VB?" questions in this forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB How-To 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 April 18th, 2005, 10:49 AM
Registered User
 
Join Date: Apr 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Pocket PC development with MS SQL

I got an error keep on prompting telling me NullReferenceException when i run the pocketpc emulator to test my development. Can anyone tell me what's the problem. I will attach my code below as reference. Thanks

rivate Sub cmdConnect_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdConnect.Click
        Dim frmSelector As New frmSelector
        Dim frmLoginMgmt As New frmLoginMgmt
        Dim conn As New SqlConnection
        Try
            conn.ConnectionString = "server=celeron; uid=James; password=something; database=LPL"
            conn.Open()
            Dim sql As SqlCommand
            sql.CommandText = "SELECT * FROM tbllogin WHERE username='txtusername.Text' AND password='txtpwd.text';"
            If sql.CommandText = True Then
                'If txtusername.Text = "admin" And txtpwd.Text = "admin" Then
                MessageBox.Show("Connection Established")
                frmSelector.Show()
            Else
                MessageBox.Show("Invalid Login Name or Password")
            End If

        Catch sqlex As SqlException
            Dim sqlError As SqlError
            For Each sqlError In sqlex.Errors
                MessageBox.Show(sqlError.Message)
            Next
        Catch ex As Exception
            MessageBox.Show(ex.Message)

        Finally
            If conn.State <> ConnectionState.Closed Then
                conn.Close()
            End If
        End Try

    End Sub
End Class





Similar Threads
Thread Thread Starter Forum Replies Last Post
Pocket PC emulator 2003 dinesherandika ASP.NET 2.0 Professional 1 December 7th, 2007 03:10 AM
SQL Server Connection for POCKET PC in VS2005 ai4u General .NET 0 November 6th, 2007 07:27 AM
pocket pc programming angelboy General .NET 1 April 23rd, 2007 07:28 AM
Setfocus on Pocket PC rtr1900 Classic ASP Basics 0 October 2nd, 2006 02:29 AM
Compact Framework on Pocket PC egem VS.NET 2002/2003 2 February 3rd, 2004 03:22 PM





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