|
-
Feb 11th, 2008, 05:04 AM
#1
Thread Starter
Addicted Member
Command
VB 6
Private Sub Command2_Click()
Dim sql As String
Dim admPassword As String
sql = "SELECT AdmPassword FROM parametri"
rsProdaja.Open sql, cnProdaja, adOpenForwardOnly, adLockReadOnly
If rsProdaja.RecordCount > 0 Then
admPassword = rsProdaja.Fields("AdmPassword").Value
rsProdaja.Close
If Text5.Text = admPassword Then
Frame1.Enabled = True
Frame2.Enabled = True
Else
MsgBox "Neispravna lozinka!", vbInformation, App.Title
End If
Text5.Text = ""
End If
End Sub
------------------------------------------------------------------------
I converted to vb2005 like this :
Is this good?
Private Sub Command2_Click()
Dim sql As String
Dim admPassword As String
sql = "SELECT AdmPassword FROM parametri"
rsProdaja.Open(sql, cnProdaja, adOpenForwardOnly, adLockReadOnly)
Dim dr2 As System.Data.SqlServerCe.SqlCeDataReader
If dr2.Read > 0 Then
admPassword = dr2("AdmPassword")
dr2.Close()
If TextBox1.Text = admPassword Then
Groupbox1.Enabled = True
Groupbox2.Enabled = True
Else
MsgBox("Neispravna lozinka!", vbInformation, App.Title)
End If
TextBox1.Text = ""
End If
End Sub
-
Feb 11th, 2008, 05:35 AM
#2
Frenzied Member
Re: Command
Hi,
Does that code work? - I would guess not.
based on my last answer in another thread
Code:
Dim cn As System.Data.SqlServerCe.SqlCeConnection
Dim cmd As System.Data.SqlServerCe.SqlCeCommand
Dim dtr As System.Data.SqlServerCe.SqlCeDataReader
Dim sql As String
Dim admPassword As String = ""
cn.connection = "Data Source=\My Documents\mydb.sdf"
Try
cn.open
catch ex as exception
messagebox.show(ex.tostring)
end try
cmd = New SqlCeCommand("SELECT AdmPassword FROM parametri", cn)
dtr = cmd.ExecuteReader()
While dtr.Read()
admPassword = dr2("AdmPassword")
End While
dtr.close
If TextBox1.Text = admPassword Then
Groupbox1.Enabled = True
Groupbox2.Enabled = True
Else
MsgBox("Neispravna lozinka!", vbInformation, App.Title)
End If
would be closer.
-
Feb 11th, 2008, 06:08 AM
#3
Thread Starter
Addicted Member
Re: Command
Thanks it work.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|