Symbianize Forum

Most of our features and services are available only to members, so we encourage you to login or register a new account. Registration is free, fast and simple. You only need to provide a valid email. Being a member you'll gain access to all member forums and features, post a message to ask question or provide answer, and share or find resources related to mobile phones, tablets, computers, game consoles, and multimedia.

All that and more, so what are you waiting for, click the register button and join us now! Ito ang website na ginawa ng pinoy para sa pinoy!

[TUT] VB6 MSAccess Sample using ADO (UPDATED V3 20100216) now with ADD and DataReport

Re: [TUT] VB6 MSAccess Sample using ADO (UPDATED V2 20091212) now with LogIn Form

Sir, pano ikonek yung database sa listview?.. yung mga data ng database to listview po.. ang ginawa ko kasi eh nag input muna ako ng mga data dun sa MS Access, ang problem ko ay kung pano ilalagay dun sa list view..

Di ko alam brod kung binabasa mo yung sample na nandyan.
Malinaw po na ipinakita sa sample kung papano maglagay ng data sa ListView, pakibasa lang yung Function na
"Private Function ListProducts() As Boolean"
sa Form na
"frmProductList"

You dont connect ang listview sa database,
gawa ka ng connection using ADODB.Connection, yan ang gagamitin para kumunek sa database using connection string.
then gawa ka ng recordset object using ADODB.Recordset,
mag connect yan sa connection object,
then ang recordset ang kukuha ng data sa tables using query.

Then simpleng looping nalang para ilagay bawat record sa listview.
Nandun sa function na sinabi ko, kung babasahin mo lang.

try to trace the sample line by line, di mo yan maiintindihan just by looking at it, use debug Step Into (F8) para makita mong mabuti.
 
Re: [TUT] VB6 MSAccess Sample using ADO (UPDATED V2 20091212) now with LogIn Form

Nice thread sir! :) salamat
 
Re: [TUT] VB6 MSAccess Sample using ADO (UPDATED V2 20091212) now with LogIn Form

@sir eric, eto po ule ako.. :rofl:

dun po sa coding niyo, sa Version 2.

at



bakit po kailangan pang gawing spaces yung mga blocks at leftover?? sa pagkakaintindi ko po kasi e ito yung iiinsert dun sa database. bakit po kailangang gawing spaces?

Ganito po yan

review kung ano ang gamit ng Function na "Get"
ang sabi "Reads data from an open disk file into a variable.
"

Get SourceFile, , FileData

kukuha ng data sa SourceFile na kasing haba ng FileData at ilalagay nya sa FileData.

tapos hinati yung file into block size

for example, meron akong file na ang size is 1024byte, block size ko is 500bytes, so sa 1024 meron akong 2 blocks plus 24 bytes, nandyan ka pa?
Code:
 ' Calculate the number of blocks to read and leftover bytes.
    NumBlocks = FileLength \ BlockSize
    LeftOver = FileLength Mod BlockSize
bale binaliktad lang, inuna INSERT yung 24 bytes

Code:
 ' Read the leftover data, writing it to the table.
    FileData = String$(LeftOver, 32)
    Get SourceFile, , FileData
    t(sField).AppendChunk (FileData)
saka nag loop sa next 2 blocks
Code:
 ' Read the remaining blocks of data, writing them to the table.
    FileData = String$(BlockSize, 32)
    For i = 1 To NumBlocks
        Get SourceFile, , FileData
        t(sField).AppendChunk (FileData)
    Next i

Getz ex?

yung original nyan di ako ang gumawa, inayos ko nalang para mas maikli ang code at mas mabilis at readable para a madla.
 
Re: [TUT] VB6 MSAccess Sample using ADO (UPDATED V2 20091212) now with LogIn Form

thanks dito sir eric!!!!:praise: galing mo po!!!:salute: salamat po sa pagtulong samin!!!!:thumbsup:
 
Re: [TUT] VB6 MSAccess Sample using ADO (UPDATED V2 20091212) now with LogIn Form

Ganito po yan

review kung ano ang gamit ng Function na "Get"
ang sabi "Reads data from an open disk file into a variable.
"

Get SourceFile, , FileData

kukuha ng data sa SourceFile na kasing haba ng FileData at ilalagay nya sa FileData.

tapos hinati yung file into block size

for example, meron akong file na ang size is 1024byte, block size ko is 500bytes, so sa 1024 meron akong 2 blocks plus 24 bytes, nandyan ka pa?
Code:
 ' Calculate the number of blocks to read and leftover bytes.
    NumBlocks = FileLength \ BlockSize
    LeftOver = FileLength Mod BlockSize
bale binaliktad lang, inuna INSERT yung 24 bytes

Code:
 ' Read the leftover data, writing it to the table.
    FileData = String$(LeftOver, 32)
    Get SourceFile, , FileData
    t(sField).AppendChunk (FileData)
saka nag loop sa next 2 blocks
Code:
 ' Read the remaining blocks of data, writing them to the table.
    FileData = String$(BlockSize, 32)
    For i = 1 To NumBlocks
        Get SourceFile, , FileData
        t(sField).AppendChunk (FileData)
    Next i

Getz ex?

yung original nyan di ako ang gumawa, inayos ko nalang para mas maikli ang code at mas mabilis at readable para a madla.

gusto ko lang po malinawan,

String$(BlockSize, 32)

bakit po 32? diba po SPACE un? edi puro space yung ililipat niya dun sa Open File?
 
Re: [TUT] VB6 MSAccess Sample using ADO (UPDATED V2 20091212) now with LogIn Form

Sir, pano yung setfocus agad sa Log-in field after mag load ng form?..

nagtry kasi ako nilagay ko sa form_load yung setfocus para sa log-in field pero error eh.

pasensya na sa NOOB na katanungan.. Novice lang talaga =)


edit: follow up Question,

Code:
rec.Open "SELECT * FROM UsersMaster WHERE UserName = '" + txtUserName.Text + "'", con, 3, 2
ahhmmn, di po to ksali dun sa code nyo. nkita ko lang dito sa Symbian sample ng Log.in..

ano po ibig sabihin nung number 3 and 2?
 
Last edited:
Re: [TUT] VB6 MSAccess Sample using ADO (UPDATED V2 20091212) now with LogIn Form

sino po may example ng Payroll.. with tutorial like sir eric did.. plz.. im so interested to learn.. i admit na newbie ako sa programming.. please help..
 
Re: [TUT] VB6 MSAccess Sample using ADO (UPDATED V2 20091212) now with LogIn Form

Sir, pano yung setfocus agad sa Log-in field after mag load ng form?..

nagtry kasi ako nilagay ko sa form_load yung setfocus para sa log-in field pero error eh.

pasensya na sa NOOB na katanungan.. Novice lang talaga =)


edit: follow up Question,

Code:
rec.Open "SELECT * FROM UsersMaster WHERE UserName = '" + txtUserName.Text + "'", con, 3, 2
ahhmmn, di po to ksali dun sa code nyo. nkita ko lang dito sa Symbian sample ng Log.in..

ano po ibig sabihin nung number 3 and 2?


sa Activate event mo ilagay yung setfocus para di mag error.
it wont work sa Load event kasi wala pang Textbox at that time, LOADIng or ginagawa palang yung textbox sa load event.
After LOAD event GAWA na or exisiting na lahat ng controls mo sa form.

yung 3 at saka 2 ay nilagay ng isang tamad na programmer lamang, may equivalent constant yan pero di nilagay dahil tinamad, not a good practice.

it refers kasi sa cursor at lock type ng binubuksang recordset
at ibang options sa pag open ng recordset, sana paglaki mo di mo gayahin yung ganyan. just put the proper option
like

Code:
rec.Open "SELECT * FROM UsersMaster WHERE UserName = '" + txtUserName.Text + "'", con, adOpenForwardOnly, adLockOptimistic

pero kung ako ihihiwalay ko sa isang variable yung SQL query para malinaw

Code:
dim sSQL as string
sSQL = "SELECT * FROM UsersMaster WHERE UserName = '" + txtUserName.Text + "'"
rec.Open sSQL, con, adOpenForwardOnly, adLockOptimistic

if i take the variable sSQL and run it sa Access data ko makikita ko yung actual output, a good way to debug your program


just take a look sa code and get the best practice na makita mo, no room here sa shortcuts ng code, di ito ASSEMBLY code.
at hindi lang ikaw ang magbabasa ng code mo, so be courteous to other programmers enough to make a clean readable code.

basahin mo nalang to
http://www.w3schools.com/ADO/met_rs_open.asp
 
Re: [TUT] VB6 MSAccess Sample using ADO (UPDATED V2 20091212) now with LogIn Form

Salamat po sa response. Nagawa ko nang iSetfocus nilagay ko po sa Activate event, dinagdagan ko na din ng "highlight" text para sa username. (napulot ko sa net kung pano).



Sir Another Question,

Ginawa ko kasi yung code mo na yung "connection" if working yung database ay dun sa Module first ichecheck. Ang problem ko, if pano ko iaacess yung database comparing yung input ng username and password towards the database.


eto sana yung code ko para dun button compare pero may error eh

Code:
Private Sub cmdLogIN_Click()


'check if recordset is open
If rec.State = 1 Then rec.Close

'SELECT tblUser FROM DATABASE COMPARING TO Username
Dim sSQL As String
sSQL = "SELECT * FROM UsersMaster WHERE UserName = '" + txtUserName.Text + "'"
[COLOR="Red"]rec.Open sSQL, con, adOpenForwardOnly, adLockOptimistic[/COLOR]


'check if username found
If rec.RecordCount = 0 Then

    MsgBox "Invalid Username", vbOKOnly + vbCritical, "LogIN"
    txtUserName.Text = ""
    txtPass.Text = ""
    txtUserName.SetFocus
    Exit Sub
    
Else

    'check if password is correct
    If StrComp(rec.Fields("Password"), txtPass.Text, vbTextCompare) = 0 Then
    
        MsgBox "Welcome " & txtUserName.Text & "!", vbOKOnly, "WELCOME"
        frmWelcome.Show
        Unload Me
        Exit Sub
        
    Else
    
        MsgBox "Invalid Password", vbOKOnly + vbCritical, "LogIN"
        
        txtPass.Text = ""
        txtPass.SetFocus
        Exit Sub
    
    End If
    
End If

End Sub

yung sample code mo po kasi, masyadong complicated eh. di ko ma gets (beginner pa kasi ako).
di ko ma trace kung pano mo po nakonek yung log-in sample mo sa database. Gusto ko po sana magstart muna sa simple, nakakasabog ng utak eh :lol:
 
Last edited:
Re: [TUT] VB6 MSAccess Sample using ADO (UPDATED V2 20091212) now with LogIn Form

Salamat po sa response. Nagawa ko nang iSetfocus nilagay ko po sa Activate event, dinagdagan ko na din ng "highlight" text para sa username. (napulot ko sa net kung pano).



Sir Another Question,

Ginawa ko kasi yung code mo na yung "connection" if working yung database ay dun sa Module first ichecheck. Ang problem ko, if pano ko iaacess yung database comparing yung input ng username and password towards the database.


eto sana yung code ko para dun button compare pero may error eh

Code:
Private Sub cmdLogIN_Click()


'check if recordset is open
If rec.State = 1 Then rec.Close

'SELECT tblUser FROM DATABASE COMPARING TO Username
Dim sSQL As String
sSQL = "SELECT * FROM UsersMaster WHERE UserName = '" + txtUserName.Text + "'"
[COLOR="Red"]rec.Open sSQL, con, adOpenForwardOnly, adLockOptimistic[/COLOR]


'check if username found
If rec.RecordCount = 0 Then

    MsgBox "Invalid Username", vbOKOnly + vbCritical, "LogIN"
    txtUserName.Text = ""
    txtPass.Text = ""
    txtUserName.SetFocus
    Exit Sub
    
Else

    'check if password is correct
    If StrComp(rec.Fields("Password"), txtPass.Text, vbTextCompare) = 0 Then
    
        MsgBox "Welcome " & txtUserName.Text & "!", vbOKOnly, "WELCOME"
        frmWelcome.Show
        Unload Me
        Exit Sub
        
    Else
    
        MsgBox "Invalid Password", vbOKOnly + vbCritical, "LogIN"
        
        txtPass.Text = ""
        txtPass.SetFocus
        Exit Sub
    
    End If
    
End If

End Sub

yung sample code mo po kasi, masyadong complicated eh. di ko ma gets (beginner pa kasi ako).
di ko ma trace kung pano mo po nakonek yung log-in sample mo sa database. Gusto ko po sana magstart muna sa simple, nakakasabog ng utak eh :lol:


Code seems ok, di mo naman sinabi kung ano ang error.
 
Re: [TUT] VB6 MSAccess Sample using ADO (UPDATED V2 20091212) now with LogIn Form

yan pong naka highlight na red.. yang po yung error eh..

sa palagay ko po di ko makonek sa database, dun kasi sa example na nakita ko (hindi po example mo), ay yung connection ay tinawag nya sa pag Load ng form. ginawa po kasing function yung connection galing sa module.
 
Re: [TUT] VB6 MSAccess Sample using ADO (UPDATED V2 20091212) now with LogIn Form

yan pong naka highlight na red.. yang po yung error eh..

sa palagay ko po di ko makonek sa database, dun kasi sa example na nakita ko (hindi po example mo), ay yung connection ay tinawag nya sa pag Load ng form. ginawa po kasing function yung connection galing sa module.

gayahin mo nalang kung papano ako mag connect sa sample
 
Re: [TUT] VB6 MSAccess Sample using ADO (UPDATED V2 20091212) now with LogIn Form

Ok po.. Try ko pag aralan, nalilito lang kasi pag di ako familiar eh. Post na lang po ako ulit sa mga katanungan ko.. tnx



Edit: Sir, Pano po para hindi ma edit yung grids ng ListView?.. nagagalaw po kasi, .

Sir, pag ginalaw ko kasi yung properties na "true/false", eh di ko na sya maselect para i.edit..
 
Last edited:
Re: [TUT] VB6 MSAccess Sample using ADO (UPDATED V2 20091212) now with LogIn Form

Ok po.. Try ko pag aralan, nalilito lang kasi pag di ako familiar eh. Post na lang po ako ulit sa mga katanungan ko.. tnx



Edit: Sir, Pano po para hindi ma edit yung grids ng ListView?.. nagagalaw po kasi, .

Sir, pag ginalaw ko kasi yung properties na "true/false", eh di ko na sya maselect para i.edit..

LabeEdit property ng Listview ang galawin mo
 
Re: [TUT] VB6 MSAccess Sample using ADO (UPDATED V2 20091212) now with LogIn Form

Sir, ano po ibig sabihin ng number 513 sa part ng code mo po.

Code:
Err.Raise vbObjectError + 513, ERR_CAN_NOT_OPEN_CONNECTION


:hi: sir eric,, eto na po yung Version 2 na may ADD.. hehe..

http://exzibit23.fileave.com/eric_VB_ADO_ACCESS_V2.rar

ano prize? :excited:

waaah! mamaw!.. Papunta pa lang ako dyan eh, lakas naman!.. pde rin ba ako magtanong sayo tol kung sakaling busy si Sir Eric?.. gusto ko talaga matuto nito eh.
 
Last edited:
Re: [TUT] VB6 MSAccess Sample using ADO (UPDATED V2 20091212) now with LogIn Form

Sir, ano po ibig sabihin ng number 513 sa part ng code mo po.

Code:
Err.Raise vbObjectError + 513, ERR_CAN_NOT_OPEN_CONNECTION




waaah! mamaw!.. Papunta pa lang ako dyan eh, lakas naman!.. pde rin ba ako magtanong sayo tol kung sakaling busy si Sir Eric?.. gusto ko talaga matuto nito eh.



Code:
Err.Raise vbObjectError + 513, ERR_CAN_NOT_OPEN_CONNECTION

up to 512 kasi ang reserved internal error codes sa vb6, so start ka ng 513,
pag nag define ako ng Error Code na 10, im sure na lampas sya sa 512 by adding 513, so in effect my error code is 513 + 10

simpleng style lang yan. pampadaling basahin ang code


mag YM kalang or mag post kung may tanong, kung sumagot ako swerte mo, kung di ako sumagot it means wala ako sa table ko.
saagot ako sa post ASAP basta may time.
habang naghihintay ka ng sagot, search ka muna sa google
 
Re: [TUT] VB6 MSAccess Sample using ADO (UPDATED V2 20091212) now with LogIn Form

Nadownload ko na, di ko pa nakikita, wala pa ako vb6 kasi sa Windows7 ko e. wait lang

Yun oh! :rofl: nakawindows 7 na siya.. hehe.. ako din maay windows7 na, pero sa Virtual Box pa lang.. sige sir, wait ko.. :thanks:
 
Re: [TUT] VB6 MSAccess Sample using ADO (UPDATED V2 20091212) now with LogIn Form

Sir, gumagamit po ba kayo ng SKINS sa VB programs nyu?.. para po sana astig tingnan..
 
Back
Top Bottom