User Profile

Collapse

Profile Sidebar

Collapse
redhat37
redhat37
Last Activity: Apr 16 '09, 01:42 PM
Joined: Mar 27 '09
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • redhat37
    replied to Attach sql mdf file in code
    I got it to work, thanks for all the excellent help, this is the solution
    Code:
                    Dim cnnConnection As New SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=" & Application.StartupPath + "\datafiles\" + TextBox1.Text + ".mdf" & ";Integrated Security=True;Database='" & TextBox1.Text & "';Connect Timeout=30")
                    cnnConnection.Open()
    ...
    See more | Go to post
    Last edited by Frinavale; Apr 14 '09, 04:10 PM. Reason: Added code tags. Please post code snippets in [code] [/code] tags.

    Leave a comment:


  • redhat37
    replied to Attach sql mdf file in code
    Database Attach

    Thanks, that works, but it does not persist the attachment in sql manager,
    Code:
                Dim cnnConnection As New SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=" & Application.StartupPath + "\datafiles\" + TextBox1.Text + ".mdf" & ";Integrated Security=True;Connect Timeout=30;User Instance=True")
    Is it possible to keep this file attached...
    See more | Go to post
    Last edited by Frinavale; Apr 14 '09, 04:10 PM. Reason: Added code tags. Please post code snippets in [code] [/code] tags.

    Leave a comment:


  • redhat37
    started a topic Attach sql mdf file in code

    Attach sql mdf file in code

    How do i attach a sql express .mdf file which is located in a certain folder on my C: drive to sql express in my code, there are many examples on the web but none of them seem to give a code example which works, I am using visual Studio 2008 and Sql Express 2005
    See more | Go to post
No activity results to display
Show More
Working...