Packaging and deploying a vb 6.0 application liked to database
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7

Thread: Packaging and deploying a vb 6.0 application liked to database

  1. #1
    Join Date
    Oct 2013
    Posts
    3

    Question Packaging and deploying a vb 6.0 application liked to database

    Hello there,

    Can someone help me on how to package and deploy vb6 project linked to database. I receive an error since after installing it on another computer it can't find the linked database.

    thanks in advance.

    Neto Romero

  2. #2
    Join Date
    Jan 2006
    Location
    Chicago, IL
    Posts
    14,986

    Re: Packaging and deploying a vb 6.0 application liked to database

    Package and Deployment Wizard should include all DB files that you attach. Otherwise, there were third-party tools that did that better. Now, you might be stuck
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  3. #3
    Join Date
    Oct 2013
    Posts
    3

    Question Re: Packaging and deploying a vb 6.0 application liked to database

    Quote Originally Posted by dglienna View Post
    Package and Deployment Wizard should include all DB files that you attach. Otherwise, there were third-party tools that did that better. Now, you might be stuck
    Thank you so much for your reply. I've decided to connect my application to the database using sql where by a customer can signup and login using the registered info. All the records are stored in Microsoft access database. Any one with an idea to do that please? I'll appreciate.

    All I need is my project should be stand alone so that to avoid hitches after packaging in vb6.0!

    Thank again,

    Neto Romero

  4. #4
    Join Date
    Jul 2005
    Posts
    1,074

    Re: Packaging and deploying a vb 6.0 application liked to database

    When using PDW you can add all the external files your project need but you need to do it manually
    But problably your problem is inside your app, that it is looking for the database in another path
    Post the code and the error and its description
    JG


    ... If your problem is fixed don't forget to mark your threads as resolved using the Thread Tools menu ...

  5. #5
    Join Date
    Oct 2013
    Posts
    3

    Re: Packaging and deploying a vb 6.0 application liked to database

    I use ADO data control to link my application to database residing on my desktop. My project runs pretty cool on my system. When I do the packaging and deployment process I always remember to attach my databases but when the process complete I install my project on a foreign computer but I receive an error when loading the form linked to database. More so, my project only runs when installed on my system when the database is on desktop when I change database position, I receive an error that database can't be found. Any solutions out there please. Thank you!

    Code:
    ‘Signup form
    Private Sub cmdfinish_Click()
    Dim msg, strfirst, strlast, strpassword As String
    strfirst = txtfirst.Text
    strlast = txtlast.Text
    strpassword = txtpassword.Text
    adosignup.Recordset.Fields("First Name") = strfirst
    adosignup.Recordset.Fields("Last Name") = strlast
    adosignup.Recordset.Fields("Password") = strpassword
    adosignup.Recordset.Update
    Me.Hide
    Call frmprint.Show
    End Sub
    Private Sub Form_Activate()
    frmsignup.Refresh
    txtfirst.Text = ""
    txtlast.Text = ""
    txtpassword.Text = ""
    txtfirst.SetFocus
    End Sub
    Private Sub Form_Load()
    On Error Resume Next
    adosignup.Recordset.AddNew
    Top = 0.5 * (Screen.Height - Height)
    Left = 0.5 * (Screen.Width - Width)
    End Sub
    
    Private Sub txtfirst_KeyPress(KeyAscii As Integer)
    If KeyAscii = vbKeyBack Then
     Exit Sub
    ElseIf KeyAscii = vbKeyDown Then
    txtlast.SetFocus
    ElseIf (KeyAscii >= vbKey0 And KeyAscii <= vbKey9) Then
     MsgBox ("Please enter non-numbers")
    Call Form_Activate
    End If
    End Sub
    
    Private Sub txtlast_KeyPress(KeyAscii As Integer)
    If KeyAscii = vbKeyBack Then
     Exit Sub
    ElseIf KeyAscii = vbKeyUp Then
    txtfirst.SetFocus
    ElseIf (KeyAscii >= vbKey0 And KeyAscii <= vbKey9) Then
     MsgBox ("Please enter non-numbers")
    Call Form_Activate
    End If
    End Sub
    
    
    Private Sub txtpassword_KeyPress(KeyAscii As Integer)
    If KeyAscii = vbKeyUp Then
    txtlast.SetFocus
    End If
    End Sub
    ‘login code
    Private Sub cmdlogin_Click()
    
    Dim first As String
    Dim last As String
    Dim pass As String
    frmsignup.adosignup.Refresh
    first = txtfname.Text
    last = txtlname.Text
    pass = txtpassword.Text
    Do Until frmsignup.adosignup.Recordset.EOF
    If (frmsignup.adosignup.Recordset.Fields("First Name").Value = first) And (frmsignup.adosignup.Recordset.Fields("Last Name").Value = last) And (frmsignup.adosignup.Recordset.Fields("Password").Value = pass) Then
    Me.Hide
    frmsaving.Show
    Exit Sub
    Else
    frmsignup.adosignup.Recordset.MoveNext
    End If
    Loop
    Response = MsgBox("Sorry, your login info is incorrect!", vbRetryCancel + vbCritical, "Access Denied")
    If Response = vbRetry Then
    Call Form_Activate
    Else
    Me.Hide
    MsgBox "Please contact the Administrator for assistance!", vbCritical
    frmwelcome.Show
    End If
    End Sub
    
    Private Sub Command1_Click()
    Me.Hide
    frmpass.Show
    End Sub
    
    Private Sub Form_Activate()
    txtfname.Text = ""
    txtlname.Text = ""
    txtpassword.Text = ""
    txtfname.SetFocus
    End Sub
    
    Private Sub Form_Load()
    Top = 0.5 * (Screen.Height - Height)
    Left = 0.5 * (Screen.Width - Width)
    End Sub
    Private Sub txtfname_KeyPress(KeyAscii As Integer)
    If KeyAscii = vbKeyBack Then
     Exit Sub
    ElseIf KeyAscii = vbKeyDown Then
    txtlname.SetFocus
    ElseIf (KeyAscii >= vbKey0 And KeyAscii <= vbKey9) Then
     MsgBox ("Please enter non-numbers")
    Call Form_Activate
    End If
    End Sub
    
    Private Sub txtlname_KeyPress(KeyAscii As Integer)
    If KeyAscii = vbKeyBack Then
     Exit Sub
    ElseIf KeyAscii = vbKeyUp Then
    txtfname.SetFocus
    ElseIf (KeyAscii >= vbKey0 And KeyAscii <= vbKey9) Then
     MsgBox ("Please enter non-numbers")
     Call Form_Activate
    End If
    End Sub
    
    Private Sub txtpassword_KeyPress(KeyAscii As Integer)
    If KeyAscii = vbKeyUp Then
    txtlname.SetFocus
    End If
    End Sub
    Last edited by GremlinSA; October 23rd, 2013 at 01:15 PM. Reason: added 'code' tags

  6. #6
    Join Date
    Jul 2005
    Posts
    1,074

    Re: Packaging and deploying a vb 6.0 application liked to database

    1 Change the ConnectionString property of the ADO DataControl in form load event giving the new db location

    Or

    2 Install your app and db in the same folder that in your development pc (example : C:\MyPrograms\MyApp)
    JG


    ... If your problem is fixed don't forget to mark your threads as resolved using the Thread Tools menu ...

  7. #7
    DataMiser is offline Super Moderator Power Poster
    Join Date
    Jul 2008
    Location
    WV
    Posts
    4,844

    Re: Packaging and deploying a vb 6.0 application liked to database

    You should never write an app to use data files on your desktop as this will lead to many problems when you try to distribute the app.
    I would also not use the ADO Control at all, Using code is a much better choice.

    As for the issue as mentioned above you should install the db in the program folder or alter the connection string to reflect the correct location
    You also need to make sure that the db is being installed with the application.

    I generally install the db in the application folder and use an ini file for the connection string which I have coded to default to app.path but allows the user to put the database somewhere else if need be such as on a shared drive for multiuser use.
    Always use [code][/code] tags when posting code.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center