borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2010 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Previous Topic (FORUM NOKIA TWITTER CONTEST)Next Topic (Access denied in SQL 2008 on image write) New Topic New Poll Post Reply
AndreaVB Forum : Database : translate vb6 to vb2005 with sql server
Poster Message
vbLearner
Level: Big Cheese

Registered: 21-04-2006
Posts: 22

Ads by Lake Quincy Media
icon translate vb6 to vb2005 with sql server

Hello Guys. i want to convert or translate my program  from vb6 to vb2005 with sql server 2005 as mydatabase

almost of my codes was made through coding.


first i created a module for data connection


''==============ModuleConnection.bas ===============
Public Function Connect(ByRef cn As ADODB.Connection, ByRef rs As ADODB.Recordset, ByRef sql) As Boolean


Connect = False
On Error GoTo ERRS


Dim vConStr As String


vconstr="Provider=SQLOLEDB.1;Password=mydbpword;Persist Security Info=True;User ID=sa;Initial Catalog=mydbase;Data Source=myserver"

cn.open vconstr

    With rs
        .CursorLocation = adUseClient    
        .Open sql, cn, adOpenKeyset, adLockOptimistic
    End With
    Connect = True
    Exit Function
'End If


Exit Function
ERRS:
If Err.Number = 0 Then
    Exit Function
Else

    MsgBox "Error " & Err.Number & " : " & (Err.Description) & vbCrLf & "Please report this to the developer for further solution !", 16, "Error"
    Connect = False
End If

End Function

' to disconnect the connection and set nothing to clear the memory
Public Sub disconnect(ByRef cn As ADODB.Connection, ByRef rs As ADODB.Recordset)
Set cn = Nothing
Set rs = Nothing

End Sub


'''''''=======================

then in form i made a program to populate the record in listview

this is my code..



'''==================FORMLISTITEMS.FRM
PUblic Sub populateListview ()

Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset
LVIEW.ListItems.Clear
vSQl = "select ITEMID,DESCRIPTION,PRIMARYCLASS,ITEMTYPE,CATEGORY  from  TBLITEMS

Connect cn, rs, vSQl
With rs
If .RecordCount > 0 Then
    .MoveFirst
    Do While Not .EOF
        Set X = LVIEW.ListItems.Add(, , UCase(!Description))
        X.SubItems(1) = UCase(!itemID)
        X.SubItems(2) = UCase(!itemtype)
        X.SubItems(3) = UCase(!primaryclass)
        X.SubItems(4) = UCase(!Category)
    .MoveNext
    Loop
    
End If
End With
disconnect cn, rs
End Sub




>>>> please guys... help me do this in vb2005 i am trying to upgrade my knowledge in vb2005 programming technology



Thank you very much guys.. i need this for my reference.. that is one of my coding technique in vb6

please help me to translate this in vb2005.. this site andreavb.com is one of my best programming tutorial since i started programming in vb6 and im hoping to upgrade again through this site.. thank you very much to all of you guys here for your helps and contribution and also the administrator who created this site.

I'm looking forward to you all for your immediate response.

regards to all and thank you in advance.

vblearner

09-02-2010 at 05:18 AM
View Profile Send Email to User Show All Posts | Quote Reply
AndreaVB Forum : Database : translate vb6 to vb2005 with sql server
Previous Topic (FORUM NOKIA TWITTER CONTEST)Next Topic (Access denied in SQL 2008 on image write) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2010 Andrea Tincaniborder