Click here to Skip to main content
15,914,924 members
Home / Discussions / Visual Basic
   

Visual Basic

 
QuestionSystem.Data.SqlClient.SqlDataReader has no instructor??? Pin
kc_renji26-Oct-07 8:07
kc_renji26-Oct-07 8:07 
AnswerRe: System.Data.SqlClient.SqlDataReader has no instructor??? Pin
Dave Kreskowiak26-Oct-07 9:54
mveDave Kreskowiak26-Oct-07 9:54 
GeneralRe: System.Data.SqlClient.SqlDataReader has no instructor??? Pin
Paul Conrad26-Oct-07 17:41
professionalPaul Conrad26-Oct-07 17:41 
GeneralRe: System.Data.SqlClient.SqlDataReader has no instructor??? Pin
Dave Kreskowiak26-Oct-07 18:13
mveDave Kreskowiak26-Oct-07 18:13 
GeneralRe: System.Data.SqlClient.SqlDataReader has no instructor??? Pin
Paul Conrad27-Oct-07 13:06
professionalPaul Conrad27-Oct-07 13:06 
AnswerRe: System.Data.SqlClient.SqlDataReader has no instructor??? Pin
pmarfleet26-Oct-07 11:48
pmarfleet26-Oct-07 11:48 
AnswerRe: System.Data.SqlClient.SqlDataReader has no instructor??? Pin
Guffa26-Oct-07 23:02
Guffa26-Oct-07 23:02 
QuestionMy Access database isn't being updated, but no errors occurred in my application Pin
SlickyMaster26-Oct-07 8:05
SlickyMaster26-Oct-07 8:05 
My Access database isn't being updated, but no errors occurred in my application
I have the following code in a class library:

Public Class clsSlaveBD
Dim strConString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\Karate.mdb;Persist Security Info=True"
Public drSlave As OleDbDataReader

Public Function getConexao() As OleDbConnection
Return New OleDbConnection(strConString)
End Function

Public Sub login(ByVal inNome As String, ByVal inPass As String, ByVal inTipo As String)
Dim comLogin As New OleDbCommand("SELECT Nome, Password, Tipo FROM Utilizadores Where (Nome=@Nome AND Password=@Pass AND Tipo=@Tipo)")

With comLogin
.Connection = getConexao()
.Connection.Open()
.Parameters.Add(New OleDbParameter("@Nome", inNome))
.Parameters.Add(New OleDbParameter("@Pass", inPass))
.Parameters.Add(New OleDbParameter("@Tipo", inTipo))
drSlave = .ExecuteReader
End With
End Sub

Public Sub altpass(ByVal inNome As String, ByVal inPass As String, ByVal inNovPass As String)
Dim comAltPass As New OleDbCommand("UPDATE [Utilizadores] SET [Password]=@NovPass WHERE [Nome]=@Nome AND [Password]=@Pass")

With comAltPass
.Connection = getConexao()
.Connection.Open()
.Parameters.Add(New OleDbParameter("@Nome", inNome))
.Parameters.Add(New OleDbParameter("@Pass", inPass))
.Parameters.Add(New OleDbParameter("@NovPass", inNovPass))
drSlave = .ExecuteReader
End With
End Sub

Protected Overrides Sub Finalize()
MyBase.Finalize()
End Sub

End Class

And in the event click of a button in a windows form the following code:

Public Class frmAltPass
Public strNovPass As String

Private Sub cmdValPass_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdValPass.Click

If txtPassAct.Text <> "" And txtNovPass.Text <> "" And txtConfPass.Text <> "" Then
If txtPassAct.Text = frmLogin.strPass And txtNovPass.Text = txtConfPass.Text Then
strNovPass = txtNovPass.Text
Dim clsSlaveBD As New BD_Slave.clsSlaveBD
clsSlaveBD.altpass(frmLogin.strUtil, frmLogin.strPass, strNovPass)
MsgBox("Password alterada com êxito", MsgBoxStyle.Information, "")
frmMDI.sbMsgAp.Text = ""
frmLogin.strPass = strNovPass
Me.Dispose()
Else
frmMDI.sbMsgAp.Text = "Erro na digitação das passwords. Reinsira a password."
Dim ctl As Control
For Each ctl In Me.Controls
If TypeOf ctl Is TextBox Then
ctl.Text = ""
End If
Next
End If
Else
MessageBox.Show("Todos os campos são de preenchimento obrigatório")
Dim ctl As Control
For Each ctl In Me.Controls
If TypeOf ctl Is TextBox And ctl.Text = "" Then
ctl.Select()
End If
Next
End If
End Sub

End Class

Both the variables frmLogin.strUtil and frmLogin.strPass are defined as Public in frmLogin form.
The application shows no errors but the database isn't updating the table "Utilizadores".

Can someone help me, please.


I have the following code in a class library:

Public Class clsSlaveBD
Dim strConString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\Karate.mdb;Persist Security Info=True"
Public drSlave As OleDbDataReader

Public Function getConexao() As OleDbConnection
Return New OleDbConnection(strConString)
End Function

Public Sub login(ByVal inNome As String, ByVal inPass As String, ByVal inTipo As String)
Dim comLogin As New OleDbCommand("SELECT Nome, Password, Tipo FROM Utilizadores Where (Nome=@Nome AND Password=@Pass AND Tipo=@Tipo)")

With comLogin
.Connection = getConexao()
.Connection.Open()
.Parameters.Add(New OleDbParameter("@Nome", inNome))
.Parameters.Add(New OleDbParameter("@Pass", inPass))
.Parameters.Add(New OleDbParameter("@Tipo", inTipo))
drSlave = .ExecuteReader
End With
End Sub

Public Sub altpass(ByVal inNome As String, ByVal inPass As String, ByVal inNovPass As String)
Dim comAltPass As New OleDbCommand("UPDATE [Utilizadores] SET [Password]=@NovPass WHERE [Nome]=@Nome AND [Password]=@Pass")

With comAltPass
.Connection = getConexao()
.Connection.Open()
.Parameters.Add(New OleDbParameter("@Nome", inNome))
.Parameters.Add(New OleDbParameter("@Pass", inPass))
.Parameters.Add(New OleDbParameter("@NovPass", inNovPass))
drSlave = .ExecuteReader
End With
End Sub

Protected Overrides Sub Finalize()
MyBase.Finalize()
End Sub

End Class

And in the event click of a button in a windows form the following code:

Public Class frmAltPass
Public strNovPass As String

Private Sub cmdValPass_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdValPass.Click

If txtPassAct.Text <> "" And txtNovPass.Text <> "" And txtConfPass.Text <> "" Then
If txtPassAct.Text = frmLogin.strPass And txtNovPass.Text = txtConfPass.Text Then
strNovPass = txtNovPass.Text
Dim clsSlaveBD As New BD_Slave.clsSlaveBD
clsSlaveBD.altpass(frmLogin.strUtil, frmLogin.strPass, strNovPass)
MsgBox("Password alterada com êxito", MsgBoxStyle.Information, "")
frmMDI.sbMsgAp.Text = ""
frmLogin.strPass = strNovPass
Me.Dispose()
Else
frmMDI.sbMsgAp.Text = "Erro na digitação das passwords. Reinsira a password."
Dim ctl As Control
For Each ctl In Me.Controls
If TypeOf ctl Is TextBox Then
ctl.Text = ""
End If
Next
End If
Else
MessageBox.Show("Todos os campos são de preenchimento obrigatório")
Dim ctl As Control
For Each ctl In Me.Controls
If TypeOf ctl Is TextBox And ctl.Text = "" Then
ctl.Select()
End If
Next
End If
End Sub

End Class

Both the variables frmLogin.strUtil and frmLogin.strPass are defined as Public Shared in frmLogin. The application shows no errors but the database isn't updating the table "Utilizadores".

Can someone help me, please.
AnswerRe: My Access database isn't being updated, but no errors occurred in my application Pin
Dave Kreskowiak26-Oct-07 9:49
mveDave Kreskowiak26-Oct-07 9:49 
GeneralRe: My Access database isn't being updated, but no errors occurred in my application Pin
Paul Conrad27-Oct-07 8:32
professionalPaul Conrad27-Oct-07 8:32 
GeneralRe: My Access database isn't being updated, but no errors occurred in my application Pin
SlickyMaster29-Oct-07 1:19
SlickyMaster29-Oct-07 1:19 
GeneralRe: My Access database isn't being updated, but no errors occurred in my application Pin
Dave Kreskowiak29-Oct-07 2:23
mveDave Kreskowiak29-Oct-07 2:23 
GeneralRe: My Access database isn't being updated, but no errors occurred in my application Pin
SlickyMaster29-Oct-07 3:58
SlickyMaster29-Oct-07 3:58 
AnswerRe: My Access database isn't being updated, but no errors occurred in my application Pin
Paul Conrad27-Oct-07 8:33
professionalPaul Conrad27-Oct-07 8:33 
GeneralRe: My Access database isn't being updated, but no errors occurred in my application Pin
SlickyMaster29-Oct-07 4:39
SlickyMaster29-Oct-07 4:39 
GeneralRe: My Access database isn't being updated, but no errors occurred in my application Pin
Paul Conrad29-Oct-07 12:57
professionalPaul Conrad29-Oct-07 12:57 
GeneralRe: My Access database isn't being updated, but no errors occurred in my application Pin
SlickyMaster30-Oct-07 1:26
SlickyMaster30-Oct-07 1:26 
GeneralRe: My Access database isn't being updated, but no errors occurred in my application Pin
SlickyMaster30-Oct-07 8:19
SlickyMaster30-Oct-07 8:19 
QuestionUsing Multiple Sets of User Settings, How do I retrieve SettingsKey values? Pin
Umbelino26-Oct-07 6:18
Umbelino26-Oct-07 6:18 
AnswerRe: Using Multiple Sets of User Settings, How do I retrieve SettingsKey values? Pin
Dave Kreskowiak26-Oct-07 6:52
mveDave Kreskowiak26-Oct-07 6:52 
GeneralRe: Using Multiple Sets of User Settings, How do I retrieve SettingsKey values? Pin
Umbelino30-Oct-07 8:13
Umbelino30-Oct-07 8:13 
QuestionCan anyone translate this c# code to vb code for me please Pin
kc_renji26-Oct-07 6:01
kc_renji26-Oct-07 6:01 
AnswerRe: Can anyone translate this c# code to vb code for me please Pin
Kschuler26-Oct-07 6:37
Kschuler26-Oct-07 6:37 
AnswerRe: Can anyone translate this c# code to vb code for me please Pin
AliAmjad26-Oct-07 6:38
AliAmjad26-Oct-07 6:38 
GeneralRe: Can anyone translate this c# code to vb code for me please Pin
kc_renji26-Oct-07 6:54
kc_renji26-Oct-07 6:54 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.