473,326 Members | 2,136 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

data back up in sql server 2005 and 2008

i want to take back up of our data base data


i request to you for give best solution for it .. code .. and it will also run whenever some one accessing our vb.net project
Dec 24 '08 #1
1 1772
OuTCasT
374 256MB
Expand|Select|Wrap|Line Numbers
  1.  
  2. dim strCompanyName as string
  3. strCompanyName = 'DBNAME'
  4.  
  5. Dim sqlcon As SqlConnection = New SqlConnection("Server=(local);Data Source=.\sqlexpress;Integrated Security=True")
  6. Dim sqlComBackupDatabase As SqlCommand = New SqlCommand("Backup database " & strCompanyName & " to disk = '" & TextBox2.Text & "'", sqlcon)
  7. Try
  8. sqlcon.Open()
  9. 'sqlComAddumpDevice.ExecuteNonQuery()
  10. 'MsgBox("Company Backup Device Created", MsgBoxStyle.Information)
  11. sqlComBackupDatabase.ExecuteNonQuery()
  12. MsgBox("Company Backup Completed Successfully", MsgBoxStyle.Information)
  13. sqlcon.Close()
  14. sqlcon.Dispose()
  15. Me.Close()
  16. MDIParent1.Enabled = False
  17. OpenCompanyTest.Show()
  18. Catch ex As Exception
  19. MsgBox("Access to the folder is denied, please choose another folder", MsgBoxStyle.Critical)
  20. sqlcon.Dispose()
  21. End Try
  22. End If
  23.  
Jan 29 '09 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

32
by: Neil Ginsberg | last post by:
We're using SQL Server 7 with an Access 2000 MDB as a front end with ODBC linked tables. I recently created a new set of tables for the app, and users are complaining that unsaved data is being...
8
by: Wingot | last post by:
Hey, I have a program I am trying to write using Visual C#, SQL Server 2005/2008, and Visual Studio 2008, and one part of it includes a Schema called Client. Inside this schema, three tables...
3
by: BobRoyAce | last post by:
I am using Visual Studio 2008 w/ VB.NET. For the database, I am using SQL Server 2005, which is running on a dedicated server box. I am creating a WinForms application for a client. It is run...
1
by: Ted | last post by:
I found this quite interesting. However, it seems to assume I have a schema defined in an xsd or xdr file. I get a data feed that appears to be well formed XML, but there is no schema. Is it...
3
by: =?Utf-8?B?YzY3NjIyOA==?= | last post by:
Hi all, I have a question for you. I have a .csv file which has many lines of data. Each line has many data fields which are delimited by ",". Now I need to extract part of data from this...
5
by: John Wright | last post by:
I am developing a program that keeps track of manufacturing defects and deviances. When a product is being developed, if there is a deviance from the standard, we have to put the part on hold and...
2
by: Justin | last post by:
I am getting this error when running on my local instance of SQL server, but it is not an issue when running on our development SQL Server box. Code: --variable declarations declare...
0
by: tskmjk | last post by:
Hi all, I am developing an application which reads an excel file which has the following records and inserts into a table in SQL SERVER 2005 database . Data: Product ...
1
by: Navs | last post by:
Hi, I am trying to insert a TIME value in a SQL Server 2008 database using a simple ODBC C program. I follow the steps below: 1. Connect and Allocate Statement handle 2. Prepare a Statement...
1
by: LitaOsiris | last post by:
Hi all, I'm getting the following error: The type 'System.Data.Common.DbConnection' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Data,...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.