Results 1 to 17 of 17

Thread: Attach MDF file to client computer

Threaded View

  1. #1

    Thread Starter
    Addicted Member Alexandru_mbm's Avatar
    Join Date
    Jul 2007
    Location
    VBForums.com
    Posts
    157

    Attach MDF file to client computer

    I have an app that uses an SQL Server Express 2008, .mdf file.

    On my computer where i've coded the app all work's fine using this code:

    Code:
            If conexiune.State <> ConnectionState.Open Then
    
                Try
    
                    conexiune.ConnectionString = "Data Source=.\SQLEXPRESS; AttachDbFilename=" & My.Settings.locatie_baza_date.ToString & "; Initial Catalog=" & My.Settings.locatie_baza_date.ToString & "; Integrated Security=True; Connect Timeout=30; User Instance=True;"
                    conexiune.Open()
    
                Catch ex As Exception
    
                    frm_afisare_eroare.lbl_cod_eroare.Text = Err.Number
                    frm_afisare_eroare.txt_detalii_eroare.Text = ex.Message & vbCrLf & vbCrLf & ex.StackTrace & vbCrLf & vbCrLf & " (" & Err.Source & "-" & Err.LastDllError & "-" & Err.Erl & ")"
                    frm_afisare_eroare.Show()
    
                End Try
    
            Else
            End If
    On the clients computer i've installed the SQL Server Express 2008 and the application and i got this error:

    ExecuteScalar requires an open avalaible Connection.

    What's wrong in this code?
    Last edited by Alexandru_mbm; Jul 23rd, 2011 at 02:28 PM.
    I'm still learning VB.NET
    Sorry for my bad english
    Thanks for your help

Posting Permissions

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



Click Here to Expand Forum to Full Width