Chat LIVE With Programming Experts! There Are 23 Online Right Now...

Welcome to Dream.In.Code
Become a VB.NET Expert!

Join 244,310 VB.NET Programmers for FREE! Get instant access to thousands of VB.NET experts, tutorials, code snippets, and more! There are 861 people online right now. Registration is fast and FREE... Join Now!




please help me convert from access to sql

 
Closed TopicStart new topic

please help me convert from access to sql

enteng
4 Sep, 2007 - 11:55 AM
Post #1

D.I.C Head
**

Joined: 2 Sep, 2007
Posts: 56



Thanked: 1 times
My Contributions
please someone help me convert this from access database to sql server 2005

thank you

CODE
Option Strict Off
Option Explicit On
Imports VB = Microsoft.VisualBasic
Friend Class frmLogin
    Inherits System.Windows.Forms.Form
    
    Private Sub Command2_Click()
        
    End Sub
    
    
    Private Sub cmdCancel_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdCancel.Click
        Me.Close()
    End Sub
    
    Private Sub cmdOk_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdOk.Click
        Dim db_file As String
        Dim statement As String
        Dim conn As ADODB.Connection
        Dim rs As ADODB.Recordset
        
        ' Open the database.
        db_file = My.Application.Info.DirectoryPath
        If VB.Right(db_file, 1) <> "\" Then db_file = db_file & "\"
        db_file = db_file & "data.mdb"
        
        ' Open a connection.
        conn = New ADODB.Connection
        conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" & db_file & ";" & "Persist Security Info=False"
        conn.Open()
        
        ' Look up the user name/password.
        statement = "SELECT COUNT (*) FROM Users WHERE " & "UserName='" & Replace(txtUserName.Text, "'", "''") & "' AND " & "Password='" & Replace(txtPassword.Text, "'", "''") & "'"
        rs = conn.Execute(statement)
        
        ' See if we got anything.
        If CInt(rs.Fields(0).Value) < 1 Then
            ' There is no match.
            ' Do not allow the login.
            Me.Close()
            MsgBox("Invalid user name/password.")
        Else
            ' There is a match.
            ' Display the program's main form.
            Form1.Show()
            Me.Close()
        End If
        
        rs.Close()
        conn.Close()
    End Sub
End Class


User is offlineProfile CardPM
+Quote Post


Jayman
RE: Please Help Me Convert From Access To Sql
4 Sep, 2007 - 11:58 AM
Post #2

Student of Life
Group Icon

Joined: 26 Dec, 2005
Posts: 8,063



Thanked: 159 times
Dream Kudos: 500
Expert In: Everything

My Contributions
Please do not continue to create duplicate topics. You already have a discussion going in another thread concerning this topic.

Topic locked.
User is offlineProfile CardPM
+Quote Post

Closed TopicStart new topic

Time is now: 7/4/09 07:23PM

Live VB.NET Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

VB.NET Tutorials

Reference Sheets

VB.NET Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month