Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. Attaching database

Attaching database

Scheduled Pinned Locked Moved C#
databasesysadminsql-server
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    hadad
    wrote on last edited by
    #1

    hello, My application depends on a sql server database I want to deploy my project in the client machine with out deploying the sql server express edition because it take some disk space and it some times cause some problems in its deployment(mainly if user don't have any experience).Is there any way to overcome this situation. thanks

    Dad

    F M 2 Replies Last reply
    0
    • H hadad

      hello, My application depends on a sql server database I want to deploy my project in the client machine with out deploying the sql server express edition because it take some disk space and it some times cause some problems in its deployment(mainly if user don't have any experience).Is there any way to overcome this situation. thanks

      Dad

      F Offline
      F Offline
      franz pilgerstorfer
      wrote on last edited by
      #2

      Hi Right-click your project and add a new installer class. Within your installer class add following code

      Public Overrides Sub Install(ByVal stateSaver As \_
        System.Collections.IDictionary)
      
          MyBase.Install(stateSaver)
      
          Try
              ' Creates the database.
              ExecuteSql("master", "CREATE DATABASE dbTest")
      
              ' Creates the tables.
              ExecuteSql(strDBName, "CREATE TABLE .....")
      
          Catch ex As Exception
              ' Reports any errors and abort.
          End Try   
      
          
      End Sub
      

      I found this code in the net. Although it is written in vb.net it may help you. Franz

      H 1 Reply Last reply
      0
      • F franz pilgerstorfer

        Hi Right-click your project and add a new installer class. Within your installer class add following code

        Public Overrides Sub Install(ByVal stateSaver As \_
          System.Collections.IDictionary)
        
            MyBase.Install(stateSaver)
        
            Try
                ' Creates the database.
                ExecuteSql("master", "CREATE DATABASE dbTest")
        
                ' Creates the tables.
                ExecuteSql(strDBName, "CREATE TABLE .....")
        
            Catch ex As Exception
                ' Reports any errors and abort.
            End Try   
        
            
        End Sub
        

        I found this code in the net. Although it is written in vb.net it may help you. Franz

        H Offline
        H Offline
        hadad
        wrote on last edited by
        #3

        thanks for help, but does it will work on a client without installing any version of sql server.The main problem is that the user will use the database as a flat database like the access database. is there a sql engine in framework 2 to attache the database to it. thanks.

        Dad

        1 Reply Last reply
        0
        • H hadad

          hello, My application depends on a sql server database I want to deploy my project in the client machine with out deploying the sql server express edition because it take some disk space and it some times cause some problems in its deployment(mainly if user don't have any experience).Is there any way to overcome this situation. thanks

          Dad

          M Offline
          M Offline
          mark_w_
          wrote on last edited by
          #4

          So basically what you are saying is you want a database on the client machine, but not install a full database environment, well sql compact is your friend http://www.microsoft.com/sql/editions/compact/default.mspx[^] one thing you cant do is have stored procs tho, but on the plus side its free :)

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups