Click here to Skip to main content
15,911,531 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Best Practices to work with databases using VB .NET Pin
RaveRare21-Aug-07 20:21
RaveRare21-Aug-07 20:21 
GeneralRe: Best Practices to work with databases using VB .NET Pin
Mark Churchill21-Aug-07 20:54
Mark Churchill21-Aug-07 20:54 
GeneralRe: Best Practices to work with databases using VB .NET Pin
RaveRare21-Aug-07 21:33
RaveRare21-Aug-07 21:33 
GeneralRe: Best Practices to work with databases using VB .NET Pin
Christian Graus21-Aug-07 21:48
protectorChristian Graus21-Aug-07 21:48 
GeneralRe: Best Practices to work with databases using VB .NET Pin
MartyK200721-Aug-07 22:23
MartyK200721-Aug-07 22:23 
GeneralRe: Best Practices to work with databases using VB .NET Pin
Mark Churchill22-Aug-07 0:20
Mark Churchill22-Aug-07 0:20 
GeneralRe: Best Practices to work with databases using VB .NET Pin
MartyK200722-Aug-07 0:49
MartyK200722-Aug-07 0:49 
QuestionADODB.RecordSet.RecordCount always return 0 or -1 Pin
vbDigger'z21-Aug-07 16:36
vbDigger'z21-Aug-07 16:36 
ADODB.RecordSet.RecordCount()
Im confused about this function

ADODB.Recordset.RecordCount???? this code below is working in VB.Net 2003

and the my recordset "dbRecordset.RecordCount" returns "0" or "1" output value only...

but then when i copy this code and used to VB 2005??? it count to what ever records it fetch from the database table...

for example: expect that there's only 1 record inside the table? yes it returns 1's value but then after that countdown it returns agained to "ZERO"

so my IF and ELSE condition were executing both???? which is something elogical???

**********************************
frmLogin.vb
*******************************

Private Sub btnOK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOk.Click

Dim dbConnection As New ADODB.Connection
Dim dbRecordset As New ADODB.Recordset

Dim strDBPath as string
Dim strSQL As String

strDBPath = "c:\database\sample.mdb"

strSQL = "SELECT * FROM tblUser WHERE UserName='" & strUsername & "' and Password='" & strPassword & "';"

dbConnection.Mode = ConnectModeEnum.adModeReadWrite

dbConnection.Open("Provider=Microsoft.Jet.OLEDB.4.0;Data source="& strDBPath)

With dbRecordset

.Open(strSQL, dbConnection, CursorTypeEnum.adOpenStatic, LockTypeEnum.adLockOptimistic, -1)

If .RecordCount = 0 Then

MsgBox("Incorrect username & password" & vbTab, MsgBoxStyle.Exclamation, "Log-in Failed")

Else

frmMain.Show()
Me.Close()

End If

.Close()
End With

dbConnection.Close()

End Sub

*****************************************

Please Help...
Please be patient, im a newbie in VB...
Thanks in advance....
AnswerRe: ADODB.RecordSet.RecordCount always return 0 or -1 Pin
jchigg200022-Aug-07 9:04
jchigg200022-Aug-07 9:04 
GeneralRe: ADODB.RecordSet.RecordCount always return 0 or -1 Pin
vbDigger'z24-Aug-07 22:08
vbDigger'z24-Aug-07 22:08 
QuestionWebbrowser Control DrawToBitmap Pin
Ahmad Zaidi21-Aug-07 13:19
Ahmad Zaidi21-Aug-07 13:19 
AnswerRe: Webbrowser Control DrawToBitmap Pin
Ahmad Zaidi21-Aug-07 13:31
Ahmad Zaidi21-Aug-07 13:31 
QuestionDrawedge API call VB2005 Pin
koosvanderhurk21-Aug-07 12:31
koosvanderhurk21-Aug-07 12:31 
AnswerRe: Drawedge API call VB2005 Pin
Christian Graus21-Aug-07 12:45
protectorChristian Graus21-Aug-07 12:45 
Questiondate variable to string variable Pin
Arif Liminto21-Aug-07 12:22
professionalArif Liminto21-Aug-07 12:22 
AnswerRe: date variable to string variable Pin
Christian Graus21-Aug-07 12:45
protectorChristian Graus21-Aug-07 12:45 
AnswerRe: date variable to string variable Pin
Mark Churchill21-Aug-07 21:07
Mark Churchill21-Aug-07 21:07 
QuestionHelp how do you loop thru each record in DataGrid Pin
Smokeywade21-Aug-07 11:06
Smokeywade21-Aug-07 11:06 
AnswerRe: Help how do you loop thru each record in DataGrid Pin
Christian Graus21-Aug-07 11:18
protectorChristian Graus21-Aug-07 11:18 
GeneralRe: Help how do you loop thru each record in DataGrid Pin
Smokeywade21-Aug-07 12:12
Smokeywade21-Aug-07 12:12 
GeneralRe: Help how do you loop thru each record in DataGrid Pin
Christian Graus21-Aug-07 12:50
protectorChristian Graus21-Aug-07 12:50 
GeneralRe: Help how do you loop thru each record in DataGrid Pin
Smokeywade21-Aug-07 13:26
Smokeywade21-Aug-07 13:26 
GeneralRe: Help how do you loop thru each record in DataGrid Pin
Christian Graus21-Aug-07 13:43
protectorChristian Graus21-Aug-07 13:43 
GeneralRe: Help how do you loop thru each record in DataGrid Pin
Smokeywade22-Aug-07 3:51
Smokeywade22-Aug-07 3:51 
QuestionHo to generate *.chm file from html files Pin
Jahnson K21-Aug-07 10:38
Jahnson K21-Aug-07 10:38 

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.